Skip to content

Commit

Permalink
Minor improvement to test failure message when a best match test fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Apr 24, 2024
1 parent a8248a2 commit 41b49c6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions jsonschema/tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
class TestBestMatch(TestCase):
def best_match_of(self, instance, schema):
errors = list(_LATEST_VERSION(schema).iter_errors(instance))
msg = f"No errors found for {instance} under {schema!r}!"
self.assertTrue(errors, msg=msg)

best = exceptions.best_match(iter(errors))
reversed_best = exceptions.best_match(reversed(errors))

self.assertEqual(
best._contents(),
reversed_best._contents(),
Expand Down

0 comments on commit 41b49c6

Please sign in to comment.