OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-domdf-python-tools?expand=0&rev=8
77 lines
2.8 KiB
Diff
77 lines
2.8 KiB
Diff
From 4cf05de26efa976b338458befffa4e9797f7458b Mon Sep 17 00:00:00 2001
|
|
From: Maxwell G <maxwell@gtmx.me>
|
|
Date: Tue, 26 Aug 2025 16:57:51 -0500
|
|
Subject: [PATCH 1/2] tests: fix pathlib.PurePosixPath repr on py3.14
|
|
|
|
``` fish
|
|
for i in python3.{9,10,11,12,13,14}
|
|
echo -n "$i "
|
|
$i -c 'import pathlib; print(repr(pathlib.PurePosixPath))'
|
|
end
|
|
```
|
|
|
|
```
|
|
python3.9 <class 'pathlib.PurePosixPath'>
|
|
python3.10 <class 'pathlib.PurePosixPath'>
|
|
python3.11 <class 'pathlib.PurePosixPath'>
|
|
python3.12 <class 'pathlib.PurePosixPath'>
|
|
python3.13 <class 'pathlib._local.PurePosixPath'>
|
|
python3.14 <class 'pathlib.PurePosixPath'>
|
|
```
|
|
---
|
|
tests/test_utils.py | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
Index: domdf_python_tools-3.10.0/tests/test_utils.py
|
|
===================================================================
|
|
--- domdf_python_tools-3.10.0.orig/tests/test_utils.py
|
|
+++ domdf_python_tools-3.10.0/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 = "<class 'pathlib._local.PurePosixPath'>"
|
|
else:
|
|
pure_posix_path_expected = "<class 'pathlib.PurePosixPath'>"
|
|
Index: domdf_python_tools-3.10.0/domdf_python_tools/words.py
|
|
===================================================================
|
|
--- domdf_python_tools-3.10.0.orig/domdf_python_tools/words.py
|
|
+++ domdf_python_tools-3.10.0/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]):
|
|
Index: domdf_python_tools-3.10.0/tests/test_paths.py
|
|
===================================================================
|
|
--- domdf_python_tools-3.10.0.orig/tests/test_paths.py
|
|
+++ domdf_python_tools-3.10.0/tests/test_paths.py
|
|
@@ -925,7 +925,7 @@ else:
|
|
|
|
|
|
@pytest.mark.parametrize("path", _from_uri_paths)
|
|
-@pytest.mark.parametrize("left_type", [pathlib.PurePath, pathlib.Path, PathPlus])
|
|
+@pytest.mark.parametrize("left_type", [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
|
|
|