diff options
author | Daniel Hahler <git@thequod.de> | 2020-02-14 02:17:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-14 02:17:05 +0100 |
commit | d89b5057cadb8716e25b783fee8a1d670e043109 (patch) | |
tree | f0d7ddc102194cc64cd605f6fa6360529849fb12 /testing/test_assertion.py | |
parent | 83137c89e926155b9c905cc6c64c84e02ec87076 (diff) | |
download | pytest-d89b5057cadb8716e25b783fee8a1d670e043109.tar.gz |
assertrepr_compare: provide more info (location) with exceptions (#6728)
Diffstat (limited to 'testing/test_assertion.py')
-rw-r--r-- | testing/test_assertion.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/testing/test_assertion.py b/testing/test_assertion.py index 0c0f12340..cf80fba43 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -677,8 +677,16 @@ class TestAssert_reprcompare: expl = callequal([], [A()]) assert "ValueError" in "".join(expl) - expl = callequal({}, {"1": A()}) - assert "faulty" in "".join(expl) + expl = callequal({}, {"1": A()}, verbose=2) + assert expl[0].startswith("{} == <[ValueError") + assert "raised in repr" in expl[0] + assert expl[1:] == [ + "(pytest_assertion plugin: representation of details failed:" + " {}:{}: ValueError: 42.".format( + __file__, A.__repr__.__code__.co_firstlineno + 1 + ), + " Probably an object has a faulty __repr__.)", + ] def test_one_repr_empty(self): """ |