diff --git a/.github/workflows/test-elementpath.yml b/.github/workflows/test-elementpath.yml index ab2d91c1..9fe9f6a8 100644 --- a/.github/workflows/test-elementpath.yml +++ b/.github/workflows/test-elementpath.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [3.8, 3.9, "3.10", 3.11, 3.12, "3.13.0", "pypy-3.10"] + python-version: [3.8, 3.9, "3.10", 3.11, 3.12, "3.13.0", "3.14.0-alpha.1", "pypy-3.10"] exclude: - os: macos-latest python-version: 3.8 @@ -41,10 +41,10 @@ jobs: flake8 elementpath --max-line-length=100 --statistics - name: Lint with mypy run: | - pip install mypy==1.11.2 xmlschema lxml-stubs + pip install mypy==1.13.0 xmlschema lxml-stubs mypy --show-error-codes --strict elementpath - name: Install optional dependencies - if: ${{ matrix.python-version != '3.13.0' }} + if: ${{ matrix.python-version != '3.14.0-alpha.1' }} run: pip install lxml - name: Test with unittest run: | diff --git a/elementpath/xpath31/_xpath31_functions.py b/elementpath/xpath31/_xpath31_functions.py index 0ab77ab0..1fac405e 100644 --- a/elementpath/xpath31/_xpath31_functions.py +++ b/elementpath/xpath31/_xpath31_functions.py @@ -764,7 +764,8 @@ def decode_value(value: SequenceType[ItemType]) -> ItemType: ) def json_object_pairs_to_map(obj: Iterable[Tuple[str, SequenceType[ItemType]]]) -> XPathMap: - items = {} + items: Dict[ItemType, SequenceType[ItemType]] = {} + for item in obj: key, value = decode_value(item[0]), decode_value(item[1]) if key in items: diff --git a/tests/test_regex.py b/tests/test_regex.py index 921a0809..744189bb 100644 --- a/tests/test_regex.py +++ b/tests/test_regex.py @@ -704,6 +704,7 @@ def test_others_unicode_blocks(self): ncp = len(unicode_block('GreekandCoptic') - unicode_category('Cn')) self.assertEqual(ncp, 135) + @unittest.skipIf(unidata_version[:2] >= '16', f"Unicode {unidata_version} is installed") def test_install_unicode_data(self): self.assertEqual(unidata_version, unicode_version()) self.assertNotIn(42971, unicode_category('Ll')) @@ -734,6 +735,37 @@ def test_install_unicode_data(self): self.assertEqual(unidata_version, unicode_version()) + @unittest.skipIf(unidata_version[:2] < '16', f"Unicode {unidata_version} is installed") + def test_install_previous_unicode_data(self): + self.assertEqual(unidata_version, unicode_version()) + self.assertIn(42971, unicode_category('Ll')) + + install_unicode_data('15.0.0') + self.assertEqual('15.0.0', unicode_version()) + self.assertNotIn(42971, unicode_category('Ll')) + + install_unicode_data() + self.assertEqual(unidata_version, unicode_version()) + self.assertIn(42971, unicode_category('Ll')) + + install_unicode_data('15.0.0', 'elementpath.regex.unicode_categories') + self.assertEqual('15.0.0', unicode_version()) + self.assertNotIn(42971, unicode_category('Ll')) + + install_unicode_data() + self.assertEqual(unidata_version, unicode_version()) + self.assertIn(42971, unicode_category('Ll')) + + with self.assertRaises(ValueError) as ctx: + install_unicode_data('14.1.0') + self.assertEqual(str(ctx.exception), "argument is not a valid Unicode version") + + with self.assertRaises(TypeError) as ctx: + install_unicode_data(name_or_url='elementpath.regex.unicode_categories') + self.assertEqual(str(ctx.exception), "you must specify a version to install") + + self.assertEqual(unidata_version, unicode_version()) + @unittest.skipUnless('TEST_UNICODE_INSTALLATION' in os.environ, "Skip UnicodeData.txt installation") def test_unicode_data_installation_from_source(self): diff --git a/tox.ini b/tox.ini index 6d7455c1..d566a2da 100644 --- a/tox.ini +++ b/tox.ini @@ -6,8 +6,8 @@ [tox] min_version = 4.0 envlist = - py{38,39,310,311,312,313}, pypy3, docs, flake8, - mypy-py{38,39,310,311,312,py3}, pytest, coverage, + py{38,39,310,311,312,313,314}, pypy3, docs, flake8, + mypy-py{38,39,310,311,312,313,py3}, pytest, coverage, xmlschema{251,302,310,321,332,342}, w3c-xsdtests skip_missing_interpreters = true work_dir = {tox_root}/../.tox/elementpath @@ -23,6 +23,11 @@ set_env = py313: TEST_UNICODE_INSTALLATION = 6.2.0 commands = python -m unittest +[testenv:py314] +deps = + elementpath>=4.4.0, <5.0.0 + jinja2 + [testenv:docs] commands = make -C doc html SPHINXOPTS="-W -n" @@ -41,9 +46,9 @@ commands = flake8 elementpath flake8 tests -[testenv:mypy-py{38,39,310,311,312,py3}] +[testenv:mypy-py{38,39,310,311,312,313,py3}] deps = - mypy==1.11.2 + mypy==1.13.0 xmlschema>=3.1.0 lxml-stubs commands =