(normalize)
| 539 | |
| 540 | @pytest.mark.parametrize("normalize", (True, False)) |
| 541 | def test_long_variable(normalize): |
| 542 | @pysnooper.snoop(normalize=normalize, color=False) |
| 543 | def my_function(): |
| 544 | foo = list(range(1000)) |
| 545 | return foo |
| 546 | |
| 547 | with mini_toolbox.OutputCapturer(stdout=False, |
| 548 | stderr=True) as output_capturer: |
| 549 | result = my_function() |
| 550 | assert result == list(range(1000)) |
| 551 | output = output_capturer.string_io.getvalue() |
| 552 | regex = r'^(?=.{100}$)\[0, 1, 2, .*\.\.\..*, 997, 998, 999\]$' |
| 553 | assert_output( |
| 554 | output, |
| 555 | ( |
| 556 | SourcePathEntry(), |
| 557 | CallEntry('def my_function():'), |
| 558 | LineEntry('foo = list(range(1000))'), |
| 559 | VariableEntry('foo', value_regex=regex), |
| 560 | LineEntry(), |
| 561 | ReturnEntry(), |
| 562 | ReturnValueEntry(value_regex=regex), |
| 563 | ElapsedTimeEntry(), |
| 564 | ), |
| 565 | normalize=normalize, |
| 566 | ) |
| 567 | |
| 568 | |
| 569 | @pytest.mark.parametrize("normalize", (True, False)) |
nothing calls this directly
no test coverage detected