From 36d098e2f51631fc97ac64488898de897e582d9c Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Mon, 11 Jul 2022 12:28:13 +0200 Subject: [PATCH] Minor tidying. --- .../tests/test_jsonschema_test_suite.py | 55 +++++++------------ 1 file changed, 21 insertions(+), 34 deletions(-) diff --git a/jsonschema/tests/test_jsonschema_test_suite.py b/jsonschema/tests/test_jsonschema_test_suite.py index 1a5bd7a40..96a6c804a 100644 --- a/jsonschema/tests/test_jsonschema_test_suite.py +++ b/jsonschema/tests/test_jsonschema_test_suite.py @@ -8,22 +8,9 @@ import sys -from jsonschema import ( - Draft3Validator, - Draft4Validator, - Draft6Validator, - Draft7Validator, - Draft201909Validator, - Draft202012Validator, - draft3_format_checker, - draft4_format_checker, - draft6_format_checker, - draft7_format_checker, - draft201909_format_checker, - draft202012_format_checker, -) from jsonschema.tests._helpers import bug from jsonschema.tests._suite import Suite +import jsonschema SUITE = Suite() DRAFT3 = SUITE.version(name="draft3") @@ -164,11 +151,11 @@ def leap_second(test): DRAFT3.optional_tests_of(name="bignum"), DRAFT3.optional_tests_of(name="non-bmp-regex"), DRAFT3.optional_tests_of(name="zeroTerminatedFloats"), - Validator=Draft3Validator, - format_checker=draft3_format_checker, + Validator=jsonschema.Draft3Validator, + format_checker=jsonschema.draft3_format_checker, skip=lambda test: ( narrow_unicode_build(test) - or missing_format(draft3_format_checker)(test) + or missing_format(jsonschema.draft3_format_checker)(test) or complex_email_validation(test) or skip( message=bug(371), @@ -188,13 +175,13 @@ def leap_second(test): DRAFT4.optional_tests_of(name="float-overflow"), DRAFT4.optional_tests_of(name="non-bmp-regex"), DRAFT4.optional_tests_of(name="zeroTerminatedFloats"), - Validator=Draft4Validator, - format_checker=draft4_format_checker, + Validator=jsonschema.Draft4Validator, + format_checker=jsonschema.draft4_format_checker, skip=lambda test: ( narrow_unicode_build(test) or allowed_leading_zeros(test) or leap_second(test) - or missing_format(draft4_format_checker)(test) + or missing_format(jsonschema.draft4_format_checker)(test) or complex_email_validation(test) or skip( message=bug(), @@ -249,13 +236,13 @@ def leap_second(test): DRAFT6.optional_tests_of(name="bignum"), DRAFT6.optional_tests_of(name="float-overflow"), DRAFT6.optional_tests_of(name="non-bmp-regex"), - Validator=Draft6Validator, - format_checker=draft6_format_checker, + Validator=jsonschema.Draft6Validator, + format_checker=jsonschema.draft6_format_checker, skip=lambda test: ( narrow_unicode_build(test) or allowed_leading_zeros(test) or leap_second(test) - or missing_format(draft6_format_checker)(test) + or missing_format(jsonschema.draft6_format_checker)(test) or complex_email_validation(test) or skip( message="id is incorrectly finding non-ids", @@ -290,13 +277,13 @@ def leap_second(test): DRAFT7.optional_tests_of(name="content"), DRAFT7.optional_tests_of(name="float-overflow"), DRAFT7.optional_tests_of(name="non-bmp-regex"), - Validator=Draft7Validator, - format_checker=draft7_format_checker, + Validator=jsonschema.Draft7Validator, + format_checker=jsonschema.draft7_format_checker, skip=lambda test: ( narrow_unicode_build(test) or allowed_leading_zeros(test) or leap_second(test) - or missing_format(draft7_format_checker)(test) + or missing_format(jsonschema.draft7_format_checker)(test) or complex_email_validation(test) or skip( message=bug(), @@ -350,7 +337,7 @@ def leap_second(test): DRAFT201909.optional_tests_of(name="float-overflow"), DRAFT201909.optional_tests_of(name="non-bmp-regex"), DRAFT201909.optional_tests_of(name="refOfUnknownKeyword"), - Validator=Draft201909Validator, + Validator=jsonschema.Draft201909Validator, skip=lambda test: ( skip( message="unevaluatedItems is different in 2019-09 (needs work).", @@ -395,13 +382,13 @@ def leap_second(test): TestDraft201909Format = DRAFT201909.to_unittest_testcase( DRAFT201909.format_tests(), - Validator=Draft201909Validator, - format_checker=draft201909_format_checker, + Validator=jsonschema.Draft201909Validator, + format_checker=jsonschema.draft201909_format_checker, skip=lambda test: ( complex_email_validation(test) or allowed_leading_zeros(test) or leap_second(test) - or missing_format(draft201909_format_checker)(test) + or missing_format(jsonschema.draft201909_format_checker)(test) or complex_email_validation(test) ), ) @@ -413,7 +400,7 @@ def leap_second(test): DRAFT202012.optional_tests_of(name="float-overflow"), DRAFT202012.optional_tests_of(name="non-bmp-regex"), DRAFT202012.optional_tests_of(name="refOfUnknownKeyword"), - Validator=Draft202012Validator, + Validator=jsonschema.Draft202012Validator, skip=lambda test: ( narrow_unicode_build(test) or skip( @@ -447,13 +434,13 @@ def leap_second(test): TestDraft202012Format = DRAFT202012.to_unittest_testcase( DRAFT202012.format_tests(), - Validator=Draft202012Validator, - format_checker=draft202012_format_checker, + Validator=jsonschema.Draft202012Validator, + format_checker=jsonschema.draft202012_format_checker, skip=lambda test: ( complex_email_validation(test) or allowed_leading_zeros(test) or leap_second(test) - or missing_format(draft202012_format_checker)(test) + or missing_format(jsonschema.draft202012_format_checker)(test) or complex_email_validation(test) ), )