From 569666850d248c04a5da67a251c7c9a390eb9bca Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Tue, 15 Jan 2019 08:55:23 -0500 Subject: Add a test for FormatChecker defaults. This is turribad. But it's also relied upon, and behavior that up-until-now is checked only in a doctest. --- jsonschema/tests/test_format.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jsonschema/tests/test_format.py b/jsonschema/tests/test_format.py index e5250f4..e9e5f99 100644 --- a/jsonschema/tests/test_format.py +++ b/jsonschema/tests/test_format.py @@ -69,3 +69,12 @@ class TestFormatChecker(TestCase): self.assertIs(cm.exception.cause, BOOM) self.assertIs(cm.exception.__cause__, BOOM) + + def test_format_checkers_come_with_defaults(self): + # This is bad :/ but relied upon. + # The docs for quite awhile recommended people do things like + # validate(..., format_checker=FormatChecker()) + # We should change that, but we can't without deprecation... + checker = FormatChecker() + with self.assertRaises(FormatError): + checker.check(instance="not-an-ipv4", format="ipv4") -- cgit v1.2.1