diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2f88278c6..8232c83e4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/ambv/black - rev: 22.1.0 + rev: 22.6.0 hooks: - id: black - repo: https://github.com/pycqa/isort diff --git a/tests/test_core/test_vdom.py b/tests/test_core/test_vdom.py index b377cc231..008a4f724 100644 --- a/tests/test_core/test_vdom.py +++ b/tests/test_core/test_vdom.py @@ -1,3 +1,5 @@ +import sys + import pytest from fastjsonschema import JsonSchemaException @@ -213,6 +215,9 @@ def test_valid_vdom(value): validate_vdom_json(value) +@pytest.mark.skipif( + sys.version_info < (3, 10), reason="error messages are different in Python<3.10" +) @pytest.mark.parametrize( "value, error_message_pattern", [ @@ -230,34 +235,34 @@ def test_valid_vdom(value): ), ( {"tagName": "tag", "children": None}, - r"data must be array", + r"data\.children must be array", ), ( {"tagName": "tag", "children": [None]}, - r"data must be object or string", + r"data\.children\[{data_x}\] must be object or string", ), ( {"tagName": "tag", "children": [{"tagName": None}]}, - r"data\.tagName must be string", + r"data\.children\[{data_x}\]\.tagName must be string", ), ( {"tagName": "tag", "attributes": None}, - r"data.attributes must be object", + r"data\.attributes must be object", ), ( {"tagName": "tag", "eventHandlers": None}, - r"data must be object", + r"data\.eventHandlers must be object", ), ( {"tagName": "tag", "eventHandlers": {"onEvent": None}}, - r"data must be object", + r"data\.eventHandlers\.{data_key} must be object", ), ( { "tagName": "tag", "eventHandlers": {"onEvent": {}}, }, - r"data must contain \['target'\] properties", + r"data\.eventHandlers\.{data_key}\ must contain \['target'\] properties", ), ( { @@ -269,7 +274,7 @@ def test_valid_vdom(value): } }, }, - r"data\.preventDefault must be boolean", + r"data\.eventHandlers\.{data_key}\.preventDefault must be boolean", ), ( { @@ -281,29 +286,29 @@ def test_valid_vdom(value): } }, }, - r"data\.stopPropagation must be boolean", + r"data\.eventHandlers\.{data_key}\.stopPropagation must be boolean", ), ( {"tagName": "tag", "importSource": None}, - r"data must be object", + r"data\.importSource must be object", ), ( {"tagName": "tag", "importSource": {}}, - r"data must contain \['source'\] properties", + r"data\.importSource must contain \['source'\] properties", ), ( { "tagName": "tag", "importSource": {"source": "something", "fallback": 0}, }, - r"data\.fallback must be object or string or null", + r"data\.importSource\.fallback must be object or string or null", ), ( { "tagName": "tag", "importSource": {"source": "something", "fallback": {"tagName": None}}, }, - r"data.tagName must be string", + r"data\.importSource\.fallback\.tagName must be string", ), ], )