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

Function test_assert_message_nested

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

Source from the content-addressed store, hash-verified

809
810
811def test_assert_message_nested() -> None:
812 # we only get one instance of aaaaaaaaaa... and bbbbbb..., but we do get multiple instances of ccccc... and dddddd..
813 # but I think this now only prints the full repr when that is necessary to disambiguate exceptions
814 with (
815 fails_raises_group(
816 "Raised exception group did not match: \n"
817 "The following expected exceptions did not find a match:\n"
818 " RaisesGroup(ValueError)\n"
819 " RaisesGroup(RaisesGroup(ValueError))\n"
820 " RaisesGroup(RaisesExc(TypeError, match='foo'))\n"
821 " RaisesGroup(TypeError, ValueError)\n"
822 "The following raised exceptions did not find a match\n"
823 " TypeError('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'):\n"
824 " RaisesGroup(ValueError): `TypeError()` is not an exception group\n"
825 " RaisesGroup(RaisesGroup(ValueError)): `TypeError()` is not an exception group\n"
826 " RaisesGroup(RaisesExc(TypeError, match='foo')): `TypeError()` is not an exception group\n"
827 " RaisesGroup(TypeError, ValueError): `TypeError()` is not an exception group\n"
828 " ExceptionGroup('Exceptions from Trio nursery', [TypeError('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb')]):\n"
829 " RaisesGroup(ValueError): `TypeError()` is not an instance of `ValueError`\n"
830 " RaisesGroup(RaisesGroup(ValueError)): RaisesGroup(ValueError): `TypeError()` is not an exception group\n"
831 " RaisesGroup(RaisesExc(TypeError, match='foo')): RaisesExc(TypeError, match='foo'): Regex pattern did not match.\n"
832 " Expected regex: 'foo'\n"
833 " Actual message: 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'\n"
834 " RaisesGroup(TypeError, ValueError): 1 matched exception. Too few exceptions raised, found no match for: [ValueError]\n"
835 " ExceptionGroup('Exceptions from Trio nursery', [TypeError('cccccccccccccccccccccccccccccc'), TypeError('dddddddddddddddddddddddddddddd')]):\n"
836 " RaisesGroup(ValueError): \n"
837 " The following expected exceptions did not find a match:\n"
838 " ValueError\n"
839 " The following raised exceptions did not find a match\n"
840 " TypeError('cccccccccccccccccccccccccccccc'):\n"
841 " `TypeError()` is not an instance of `ValueError`\n"
842 " TypeError('dddddddddddddddddddddddddddddd'):\n"
843 " `TypeError()` is not an instance of `ValueError`\n"
844 " RaisesGroup(RaisesGroup(ValueError)): \n"
845 " The following expected exceptions did not find a match:\n"
846 " RaisesGroup(ValueError)\n"
847 " The following raised exceptions did not find a match\n"
848 " TypeError('cccccccccccccccccccccccccccccc'):\n"
849 " RaisesGroup(ValueError): `TypeError()` is not an exception group\n"
850 " TypeError('dddddddddddddddddddddddddddddd'):\n"
851 " RaisesGroup(ValueError): `TypeError()` is not an exception group\n"
852 " RaisesGroup(RaisesExc(TypeError, match='foo')): \n"
853 " The following expected exceptions did not find a match:\n"
854 " RaisesExc(TypeError, match='foo')\n"
855 " The following raised exceptions did not find a match\n"
856 " TypeError('cccccccccccccccccccccccccccccc'):\n"
857 " RaisesExc(TypeError, match='foo'): Regex pattern did not match.\n"
858 " Expected regex: 'foo'\n"
859 " Actual message: 'cccccccccccccccccccccccccccccc'\n"
860 " TypeError('dddddddddddddddddddddddddddddd'):\n"
861 " RaisesExc(TypeError, match='foo'): Regex pattern did not match.\n"
862 " Expected regex: 'foo'\n"
863 " Actual message: 'dddddddddddddddddddddddddddddd'\n"
864 " RaisesGroup(TypeError, ValueError): \n"
865 " 1 matched exception. \n"
866 " The following expected exceptions did not find a match:\n"
867 " ValueError\n"
868 " The following raised exceptions did not find a match\n"

Callers

nothing calls this directly

Calls 3

RaisesGroupClass · 0.90
RaisesExcClass · 0.90
fails_raises_groupFunction · 0.85

Tested by

no test coverage detected