(normalize)
| 626 | |
| 627 | @pytest.mark.parametrize("normalize", (True, False)) |
| 628 | def test_repr_exception(normalize): |
| 629 | class Bad(object): |
| 630 | def __repr__(self): |
| 631 | 1 / 0 |
| 632 | |
| 633 | @pysnooper.snoop(normalize=normalize, color=False) |
| 634 | def my_function(): |
| 635 | bad = Bad() |
| 636 | |
| 637 | with mini_toolbox.OutputCapturer(stdout=False, |
| 638 | stderr=True) as output_capturer: |
| 639 | result = my_function() |
| 640 | assert result is None |
| 641 | output = output_capturer.string_io.getvalue() |
| 642 | assert_output( |
| 643 | output, |
| 644 | ( |
| 645 | SourcePathEntry(), |
| 646 | VariableEntry('Bad'), |
| 647 | CallEntry('def my_function():'), |
| 648 | LineEntry('bad = Bad()'), |
| 649 | VariableEntry('bad', value='REPR FAILED'), |
| 650 | ReturnEntry(), |
| 651 | ReturnValueEntry('None'), |
| 652 | ElapsedTimeEntry(), |
| 653 | ), |
| 654 | normalize=normalize, |
| 655 | ) |
| 656 | |
| 657 | |
| 658 | @pytest.mark.parametrize("normalize", (True, False)) |
nothing calls this directly
no test coverage detected