diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml index 03f5a31..a1e0828 100644 --- a/.github/workflows/python_ci.yml +++ b/.github/workflows/python_ci.yml @@ -22,7 +22,7 @@ jobs: runs-on: "windows-2022" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9,pypy-3.10' + USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,3.14,pypy-3.7,pypy-3.8,pypy-3.9,pypy-3.10' strategy: fail-fast: False @@ -35,6 +35,7 @@ jobs: - {python-version: "3.11", testenvs: "py311,build", experimental: False} - {python-version: "3.12", testenvs: "py312,build", experimental: False} - {python-version: "3.13", testenvs: "py313,build", experimental: False} + - {python-version: "3.14", testenvs: "py314,build", experimental: False} - {python-version: "pypy-3.7", testenvs: "pypy37,build", experimental: False} - {python-version: "pypy-3.8", testenvs: "pypy38", experimental: False} - {python-version: "pypy-3.9-v7.3.15", testenvs: "pypy39", experimental: True} diff --git a/.github/workflows/python_ci_linux.yml b/.github/workflows/python_ci_linux.yml index 05f968a..4696b8e 100644 --- a/.github/workflows/python_ci_linux.yml +++ b/.github/workflows/python_ci_linux.yml @@ -23,7 +23,7 @@ jobs: runs-on: "ubuntu-22.04" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9,pypy-3.10' + USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,3.14,pypy-3.7,pypy-3.8,pypy-3.9,pypy-3.10' strategy: fail-fast: False @@ -36,6 +36,7 @@ jobs: - {python-version: "3.11", testenvs: "py311,build", experimental: False} - {python-version: "3.12", testenvs: "py312,build", experimental: False} - {python-version: "3.13", testenvs: "py313,build", experimental: False} + - {python-version: "3.14", testenvs: "py314,build", experimental: False} - {python-version: "pypy-3.7", testenvs: "pypy37,build", experimental: False} - {python-version: "pypy-3.8", testenvs: "pypy38,build", experimental: False} - {python-version: "pypy-3.9", testenvs: "pypy39,build", experimental: True} diff --git a/.github/workflows/python_ci_macos.yml b/.github/workflows/python_ci_macos.yml index 2afbc2b..b4e7cbd 100644 --- a/.github/workflows/python_ci_macos.yml +++ b/.github/workflows/python_ci_macos.yml @@ -22,7 +22,7 @@ jobs: runs-on: "macos-${{ matrix.config.os-ver }}" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9,pypy-3.10' + USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,3.14,pypy-3.7,pypy-3.8,pypy-3.9,pypy-3.10' strategy: fail-fast: False @@ -35,6 +35,7 @@ jobs: - {python-version: "3.11", os-ver: "14", testenvs: "py311,build", experimental: False} - {python-version: "3.12", os-ver: "14", testenvs: "py312,build", experimental: False} - {python-version: "3.13", os-ver: "14", testenvs: "py313,build", experimental: False} + - {python-version: "3.14", os-ver: "14", testenvs: "py314,build", experimental: False} - {python-version: "pypy-3.7", os-ver: "15-intel", testenvs: "pypy37,build", experimental: False} - {python-version: "pypy-3.8", os-ver: "14", testenvs: "pypy38,build", experimental: False} - {python-version: "pypy-3.9", os-ver: "14", testenvs: "pypy39,build", experimental: True} diff --git a/domdf_python_tools/words.py b/domdf_python_tools/words.py index 40967f2..ad2e5fe 100644 --- a/domdf_python_tools/words.py +++ b/domdf_python_tools/words.py @@ -171,14 +171,13 @@ def alpha_sort( alphabet_ = list(alphabet) - try: - return sorted(iterable, key=lambda attr: [alphabet_.index(letter) for letter in attr], reverse=reverse) - except ValueError as e: - m = re.match(r"'(.*)' is not in list", str(e)) - if m: - raise ValueError(f"The character {m.group(1)!r} was not found in the alphabet.") from None - else: # pragma: no cover - raise e + def _alphabet_index(letter: str) -> int: + try: + return alphabet_.index(letter) + except ValueError: + raise ValueError(f"The character {letter!r} was not found in the alphabet.") from None + + return sorted(iterable, key=lambda attr: [_alphabet_index(letter) for letter in attr], reverse=reverse) class Font(Dict[str, str]): diff --git a/pyproject.toml b/pyproject.toml index 163c55c..b1bdb9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules", @@ -142,7 +143,7 @@ base-classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules", "Typing :: Typed", ] -python-versions = [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13",] +python-versions = [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14",] python-implementations = [ "CPython", "PyPy",] platforms = [ "Windows", "macOS", "Linux",] license-key = "MIT" diff --git a/repo_helper.yml b/repo_helper.yml index 61f9a3f..dafed9a 100644 --- a/repo_helper.yml +++ b/repo_helper.yml @@ -25,6 +25,7 @@ python_versions: "3.11": "3.12": "3.13": + "3.14": pypy37: pypy38: pypy39: diff --git a/tests/test_paths.py b/tests/test_paths.py index 22e411b..7567941 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -20,7 +20,7 @@ # 3rd party import pytest from coincidence.regressions import AdvancedDataRegressionFixture -from coincidence.selectors import not_pypy, not_windows, only_windows +from coincidence.selectors import max_version, not_pypy, not_windows, only_windows # this package from domdf_python_tools import paths @@ -925,7 +925,13 @@ def test_sort_paths(): @pytest.mark.parametrize("path", _from_uri_paths) -@pytest.mark.parametrize("left_type", [pathlib.PurePath, pathlib.Path, PathPlus]) +@pytest.mark.parametrize( + "left_type", [ + pytest.param(pathlib.PurePath, marks=max_version((3, 13))), + pathlib.Path, + PathPlus, + ] + ) def test_pathplus_from_uri(path: str, left_type: Type): assert PathPlus.from_uri(left_type(path).as_uri()).as_posix() == path diff --git a/tests/test_utils.py b/tests/test_utils.py index 768bd83..08809e2 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -124,7 +124,7 @@ def test_printr(obj, expects, capsys): assert re.match(expects, stdout[0]) -if sys.version_info >= (3, 13): +if sys.version_info[:2] == (3, 13): pure_posix_path_expected = "" else: pure_posix_path_expected = "" diff --git a/tox.ini b/tox.ini index 24cfcdc..3422d70 100644 --- a/tox.ini +++ b/tox.ini @@ -29,6 +29,7 @@ envlist = py311 py312 py313 + py314 pypy37 pypy38 pypy39 @@ -52,6 +53,7 @@ test = py311 py312 py313 + py314 pypy37 pypy38 pypy39