diff options
author | Julian Berman <Julian@GrayVines.com> | 2019-01-15 08:55:23 -0500 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2019-01-15 08:55:23 -0500 |
commit | 569666850d248c04a5da67a251c7c9a390eb9bca (patch) | |
tree | c48a84502e02b695cb0813cd2a27401eba351f3e | |
parent | 82d0e2111ccf324a5ff9727ef350fd46485f8cef (diff) | |
download | jsonschema-569666850d248c04a5da67a251c7c9a390eb9bca.tar.gz |
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.
-rw-r--r-- | jsonschema/tests/test_format.py | 9 |
1 files changed, 9 insertions, 0 deletions
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") |