MCPcopy
hub / github.com/pytest-dev/pytest / test_message_indent

Function test_message_indent

testing/python/raises_group.py:676–741  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

674
675
676def test_message_indent() -> None:
677 with (
678 fails_raises_group(
679 "Raised exception group did not match: \n"
680 "The following expected exceptions did not find a match:\n"
681 " RaisesGroup(ValueError, ValueError)\n"
682 " ValueError\n"
683 "The following raised exceptions did not find a match\n"
684 " ExceptionGroup('', [TypeError(), RuntimeError()]):\n"
685 " RaisesGroup(ValueError, ValueError): \n"
686 " The following expected exceptions did not find a match:\n"
687 " ValueError\n"
688 " ValueError\n"
689 " The following raised exceptions did not find a match\n"
690 " TypeError():\n"
691 " `TypeError()` is not an instance of `ValueError`\n"
692 " `TypeError()` is not an instance of `ValueError`\n"
693 " RuntimeError():\n"
694 " `RuntimeError()` is not an instance of `ValueError`\n"
695 " `RuntimeError()` is not an instance of `ValueError`\n"
696 # TODO: this line is not great, should maybe follow the same format as the other and say
697 # ValueError: Unexpected nested `ExceptionGroup()` (?)
698 " Unexpected nested `ExceptionGroup()`, expected `ValueError`\n"
699 " TypeError():\n"
700 " RaisesGroup(ValueError, ValueError): `TypeError()` is not an exception group\n"
701 " `TypeError()` is not an instance of `ValueError`",
702 add_prefix=False,
703 ),
704 RaisesGroup(
705 RaisesGroup(ValueError, ValueError),
706 ValueError,
707 ),
708 ):
709 raise ExceptionGroup(
710 "",
711 [
712 ExceptionGroup("", [TypeError(), RuntimeError()]),
713 TypeError(),
714 ],
715 )
716 with (
717 fails_raises_group(
718 "Raised exception group did not match: \n"
719 "RaisesGroup(ValueError, ValueError): \n"
720 " The following expected exceptions did not find a match:\n"
721 " ValueError\n"
722 " ValueError\n"
723 " The following raised exceptions did not find a match\n"
724 " TypeError():\n"
725 " `TypeError()` is not an instance of `ValueError`\n"
726 " `TypeError()` is not an instance of `ValueError`\n"
727 " RuntimeError():\n"
728 " `RuntimeError()` is not an instance of `ValueError`\n"
729 " `RuntimeError()` is not an instance of `ValueError`",
730 add_prefix=False,
731 ),
732 RaisesGroup(
733 RaisesGroup(ValueError, ValueError),

Callers

nothing calls this directly

Calls 2

RaisesGroupClass · 0.90
fails_raises_groupFunction · 0.85

Tested by

no test coverage detected