(self, importasmod, tw_mock)
| 921 | assert x == "я" |
| 922 | |
| 923 | def test_toterminal_long(self, importasmod, tw_mock): |
| 924 | mod = importasmod( |
| 925 | """ |
| 926 | def g(x): |
| 927 | raise ValueError(x) |
| 928 | def f(): |
| 929 | g(3) |
| 930 | """ |
| 931 | ) |
| 932 | excinfo = pytest.raises(ValueError, mod.f) |
| 933 | excinfo.traceback = excinfo.traceback.filter() |
| 934 | repr = excinfo.getrepr() |
| 935 | repr.toterminal(tw_mock) |
| 936 | assert tw_mock.lines[0] == "" |
| 937 | tw_mock.lines.pop(0) |
| 938 | assert tw_mock.lines[0] == " def f():" |
| 939 | assert tw_mock.lines[1] == "> g(3)" |
| 940 | assert tw_mock.lines[2] == "" |
| 941 | line = tw_mock.get_write_msg(3) |
| 942 | assert line.endswith("mod.py") |
| 943 | assert tw_mock.lines[4] == (":5: ") |
| 944 | assert tw_mock.lines[5] == ("_ ", None) |
| 945 | assert tw_mock.lines[6] == "" |
| 946 | assert tw_mock.lines[7] == " def g(x):" |
| 947 | assert tw_mock.lines[8] == "> raise ValueError(x)" |
| 948 | assert tw_mock.lines[9] == "E ValueError: 3" |
| 949 | assert tw_mock.lines[10] == "" |
| 950 | line = tw_mock.get_write_msg(11) |
| 951 | assert line.endswith("mod.py") |
| 952 | assert tw_mock.lines[12] == ":3: ValueError" |
| 953 | |
| 954 | def test_toterminal_long_missing_source( |
| 955 | self, importasmod, tmp_path: Path, tw_mock |
nothing calls this directly
no test coverage detected