MCPcopy
hub / github.com/cool-RR/PySnooper / test_repr_exception

Function test_repr_exception

tests/test_pysnooper.py:628–655  ·  view source on GitHub ↗
(normalize)

Source from the content-addressed store, hash-verified

626
627@pytest.mark.parametrize("normalize", (True, False))
628def 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))

Callers

nothing calls this directly

Calls 9

my_functionFunction · 0.85
assert_outputFunction · 0.85
SourcePathEntryClass · 0.85
VariableEntryClass · 0.85
CallEntryClass · 0.85
LineEntryClass · 0.85
ReturnEntryClass · 0.85
ReturnValueEntryClass · 0.85
ElapsedTimeEntryClass · 0.85

Tested by

no test coverage detected