(normalize)
| 496 | |
| 497 | @pytest.mark.parametrize("normalize", (True, False)) |
| 498 | def test_single_watch_no_comma(normalize): |
| 499 | class Foo(object): |
| 500 | def __init__(self): |
| 501 | self.x = 2 |
| 502 | |
| 503 | def square(self): |
| 504 | self.x **= 2 |
| 505 | |
| 506 | @pysnooper.snoop(watch='foo', normalize=normalize, color=False) |
| 507 | def my_function(): |
| 508 | foo = Foo() |
| 509 | for i in range(2): |
| 510 | foo.square() |
| 511 | |
| 512 | with mini_toolbox.OutputCapturer(stdout=False, |
| 513 | stderr=True) as output_capturer: |
| 514 | result = my_function() |
| 515 | assert result is None |
| 516 | output = output_capturer.string_io.getvalue() |
| 517 | assert_output( |
| 518 | output, |
| 519 | ( |
| 520 | SourcePathEntry(), |
| 521 | VariableEntry('Foo'), |
| 522 | CallEntry('def my_function():'), |
| 523 | LineEntry('foo = Foo()'), |
| 524 | VariableEntry('foo'), |
| 525 | LineEntry(), |
| 526 | VariableEntry('i', '0'), |
| 527 | LineEntry(), |
| 528 | LineEntry(), |
| 529 | VariableEntry('i', '1'), |
| 530 | LineEntry(), |
| 531 | LineEntry(), |
| 532 | ReturnEntry(), |
| 533 | ReturnValueEntry('None'), |
| 534 | ElapsedTimeEntry(), |
| 535 | ), |
| 536 | normalize=normalize, |
| 537 | ) |
| 538 | |
| 539 | |
| 540 | @pytest.mark.parametrize("normalize", (True, False)) |
nothing calls this directly
no test coverage detected