|
25 | 25 | pypy_version_info = None
|
26 | 26 |
|
27 | 27 | from jsonschema import (
|
28 |
| - PY3, FormatError, SchemaError, UnknownType, ValidationError, ErrorTree, |
29 |
| - Draft3Validator, Draft4Validator, FormatChecker, RefResolver, |
30 |
| - ValidatorMixin, draft3_format_checker, draft4_format_checker, validate, |
| 28 | + PY3, FormatError, RefResolutionError, SchemaError, UnknownType, |
| 29 | + ValidationError, ErrorTree, Draft3Validator, Draft4Validator, |
| 30 | + FormatChecker, RefResolver, ValidatorMixin, draft3_format_checker, |
| 31 | + draft4_format_checker, validate, |
31 | 32 | )
|
32 | 33 |
|
33 | 34 |
|
@@ -715,6 +716,16 @@ def test_cache_remote_off(self):
|
715 | 716 | pass
|
716 | 717 | self.assertEqual(foo_handler.call_count, 2)
|
717 | 718 |
|
| 719 | + def test_if_you_give_it_junk_you_get_a_resolution_error(self): |
| 720 | + ref = "foo://bar" |
| 721 | + foo_handler = mock.Mock(side_effect=ValueError("Oh no! What's this?")) |
| 722 | + resolver = RefResolver("", {}, cache_remote=True, |
| 723 | + handlers={"foo": foo_handler}) |
| 724 | + with self.assertRaises(RefResolutionError) as err: |
| 725 | + with resolver.resolving(ref): |
| 726 | + pass |
| 727 | + self.assertEqual(str(err.exception), "Oh no! What's this?") |
| 728 | + |
718 | 729 |
|
719 | 730 | class TestFormatChecker(unittest.TestCase):
|
720 | 731 | def setUp(self):
|
|
0 commit comments