OXIESEC PANEL
- Current Dir:
/
/
snap
/
core24
/
888
/
usr
/
lib
/
python3
/
dist-packages
/
jsonschema
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
03/18/2025 08:12:15 AM
rwxr-xr-x
📄
__init__.py
0 bytes
08/14/2023 09:45:04 PM
rw-r--r--
📁
__pycache__
-
03/18/2025 08:12:15 AM
rwxr-xr-x
📄
_helpers.py
623 bytes
08/14/2023 09:45:04 PM
rw-r--r--
📄
_suite.py
6.86 KB
08/14/2023 09:45:04 PM
rw-r--r--
📄
fuzz_validate.py
1.09 KB
08/14/2023 09:45:04 PM
rw-r--r--
📄
test_cli.py
28.06 KB
08/14/2023 09:45:04 PM
rw-r--r--
📄
test_deprecations.py
3.81 KB
08/14/2023 09:45:04 PM
rw-r--r--
📄
test_exceptions.py
18.74 KB
08/14/2023 09:45:04 PM
rw-r--r--
📄
test_format.py
3.67 KB
08/14/2023 09:45:04 PM
rw-r--r--
📄
test_jsonschema_test_suite.py
20.7 KB
08/14/2023 09:45:04 PM
rw-r--r--
📄
test_types.py
6.64 KB
08/14/2023 09:45:04 PM
rw-r--r--
📄
test_utils.py
3.66 KB
08/14/2023 09:45:04 PM
rw-r--r--
📄
test_validators.py
73.71 KB
08/14/2023 09:45:04 PM
rw-r--r--
Editing: test_deprecations.py
Close
from unittest import TestCase from jsonschema import validators class TestDeprecations(TestCase): def test_version(self): """ As of v4.0.0, __version__ is deprecated in favor of importlib.metadata. """ with self.assertWarns(DeprecationWarning) as w: from jsonschema import __version__ # noqa self.assertEqual(w.filename, __file__) self.assertTrue( str(w.warning).startswith( "Accessing jsonschema.__version__ is deprecated", ), ) def test_validators_ErrorTree(self): """ As of v4.0.0, importing ErrorTree from jsonschema.validators is deprecated in favor of doing so from jsonschema.exceptions. """ with self.assertWarns(DeprecationWarning) as w: from jsonschema.validators import ErrorTree # noqa self.assertEqual(w.filename, __file__) self.assertTrue( str(w.warning).startswith( "Importing ErrorTree from jsonschema.validators is deprecated", ), ) def test_validators_validators(self): """ As of v4.0.0, accessing jsonschema.validators.validators is deprecated. """ with self.assertWarns(DeprecationWarning) as w: value = validators.validators self.assertEqual(value, validators._VALIDATORS) self.assertEqual(w.filename, __file__) self.assertTrue( str(w.warning).startswith( "Accessing jsonschema.validators.validators is deprecated", ), ) def test_validators_meta_schemas(self): """ As of v4.0.0, accessing jsonschema.validators.meta_schemas is deprecated. """ with self.assertWarns(DeprecationWarning) as w: value = validators.meta_schemas self.assertEqual(value, validators._META_SCHEMAS) self.assertEqual(w.filename, __file__) self.assertTrue( str(w.warning).startswith( "Accessing jsonschema.validators.meta_schemas is deprecated", ), ) def test_RefResolver_in_scope(self): """ As of v4.0.0, RefResolver.in_scope is deprecated. """ resolver = validators.RefResolver.from_schema({}) with self.assertWarns(DeprecationWarning) as w: with resolver.in_scope("foo"): pass self.assertEqual(w.filename, __file__) self.assertTrue( str(w.warning).startswith( "jsonschema.RefResolver.in_scope is deprecated ", ), ) def test_Validator_is_valid_two_arguments(self): """ As of v4.0.0, calling is_valid with two arguments (to provide a different schema) is deprecated. """ validator = validators.Draft7Validator({}) with self.assertWarns(DeprecationWarning) as w: result = validator.is_valid("foo", {"type": "number"}) self.assertFalse(result) self.assertEqual(w.filename, __file__) self.assertTrue( str(w.warning).startswith( "Passing a schema to Validator.is_valid is deprecated ", ), ) def test_Validator_iter_errors_two_arguments(self): """ As of v4.0.0, calling iter_errors with two arguments (to provide a different schema) is deprecated. """ validator = validators.Draft7Validator({}) with self.assertWarns(DeprecationWarning) as w: error, = validator.iter_errors("foo", {"type": "number"}) self.assertEqual(error.validator, "type") self.assertEqual(w.filename, __file__) self.assertTrue( str(w.warning).startswith( "Passing a schema to Validator.iter_errors is deprecated ", ), )