plexus-python-common 1.1.91__tar.gz → 1.1.92__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/PKG-INFO +2 -2
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/pyproject.toml +3 -2
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/testutils.py +41 -27
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus_python_common.egg-info/PKG-INFO +2 -2
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus_python_common.egg-info/requires.txt +1 -1
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/testutils_test.py +19 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/.editorconfig +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/.github/workflows/pr.yml +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/.github/workflows/push.yml +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/.gitignore +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/MANIFEST.in +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/README.md +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/VERSION +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/config/config.cfg +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/csvutils/data.csv +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/csvutils/data.tsv +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/pathutils/dir.baz/file.bar.baz +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/pathutils/dir.baz/file.foo.bar +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/pathutils/dir.baz/file.foo.baz +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/pathutils/dir.foo/dir.foo.bar/dir.foo.bar.baz/file.foo.bar.baz +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/pathutils/dir.foo/dir.foo.bar/file.bar.baz +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/pathutils/dir.foo/dir.foo.bar/file.foo.bar +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/pathutils/dir.foo/dir.foo.bar/file.foo.baz +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/pathutils/dir.foo/file.bar +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/pathutils/dir.foo/file.baz +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/pathutils/dir.foo/file.foo +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/setup.cfg +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/setup.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/__init__.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/__init__.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/argutils.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/config.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/csvutils.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/dbutils.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/dtutils.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/funcutils.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/iterutils.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/jsonutils.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/logger.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/numutils.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/pathutils.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/randutils.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/retry.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/span.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/strutils.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/typeutils.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus_python_common.egg-info/SOURCES.txt +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus_python_common.egg-info/dependency_links.txt +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus_python_common.egg-info/not-zip-safe +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus_python_common.egg-info/top_level.txt +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/__init__.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/__init__.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/__init__.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/argutils_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/config_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/csvutils_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/dbutils_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/dtutils_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/funcutils_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/iterutils_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/jsonutils_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/logger_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/numutils_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/pathutils_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/randutils_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/retry_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/span_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/strutils_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/utils/typeutils_test.py +0 -0
- {plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/testenv.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plexus-python-common
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.92
|
|
4
4
|
Classifier: Programming Language :: Python :: 3
|
|
5
5
|
Classifier: Programming Language :: Python :: 3.12
|
|
6
6
|
Classifier: Programming Language :: Python :: 3.13
|
|
@@ -20,4 +20,4 @@ Requires-Dist: pytest-cov>=5.0; extra == "test"
|
|
|
20
20
|
Requires-Dist: pytest-mysql>=3.0; extra == "test"
|
|
21
21
|
Requires-Dist: pytest-order>=1.3; extra == "test"
|
|
22
22
|
Requires-Dist: pytest-postgresql>=6.1; extra == "test"
|
|
23
|
-
Requires-Dist: pytest>=
|
|
23
|
+
Requires-Dist: pytest>=9.2; extra == "test"
|
|
@@ -21,7 +21,7 @@ test = [
|
|
|
21
21
|
"pytest-mysql>=3.0",
|
|
22
22
|
"pytest-order>=1.3",
|
|
23
23
|
"pytest-postgresql>=6.1",
|
|
24
|
-
"pytest>=
|
|
24
|
+
"pytest>=9.2",
|
|
25
25
|
]
|
|
26
26
|
|
|
27
27
|
[project]
|
|
@@ -53,7 +53,7 @@ test = [
|
|
|
53
53
|
"pytest-mysql>=3.0",
|
|
54
54
|
"pytest-order>=1.3",
|
|
55
55
|
"pytest-postgresql>=6.1",
|
|
56
|
-
"pytest>=
|
|
56
|
+
"pytest>=9.2",
|
|
57
57
|
]
|
|
58
58
|
|
|
59
59
|
[tool.setuptools]
|
|
@@ -67,6 +67,7 @@ namespaces = true
|
|
|
67
67
|
|
|
68
68
|
[tool.pytest.ini_options]
|
|
69
69
|
pythonpath = ["src"]
|
|
70
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
70
71
|
|
|
71
72
|
[tool.coverage.run]
|
|
72
73
|
branch = true
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/testutils.py
RENAMED
|
@@ -4,7 +4,7 @@ from decimal import Decimal
|
|
|
4
4
|
from typing import Any, Protocol
|
|
5
5
|
|
|
6
6
|
import pytest
|
|
7
|
-
from _pytest.
|
|
7
|
+
from _pytest.approx import ApproxDecimal, ApproxMapping, ApproxSequenceLike
|
|
8
8
|
|
|
9
9
|
from plexus.common.utils.numutils import to_decimal
|
|
10
10
|
|
|
@@ -16,8 +16,14 @@ __all__ = [
|
|
|
16
16
|
"throw_callee",
|
|
17
17
|
]
|
|
18
18
|
|
|
19
|
+
SupportApprox = int | float | str | bool | list | tuple | dict | Decimal | datetime.datetime | datetime.date | datetime.time | datetime.timedelta | None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ApproxNestedMixin(pytest.Approx):
|
|
23
|
+
def __init__(self, expected, rel: SupportApprox = None, abs: SupportApprox = None, nan_ok: bool = False):
|
|
24
|
+
# Bypass the container constructors, which reject nested values.
|
|
25
|
+
pytest.Approx.__init__(self, expected, rel, abs, nan_ok)
|
|
19
26
|
|
|
20
|
-
class ApproxNestedMixin(ApproxBase):
|
|
21
27
|
def __repr__(self) -> str:
|
|
22
28
|
|
|
23
29
|
def recur_repr_helper(obj):
|
|
@@ -28,42 +34,50 @@ class ApproxNestedMixin(ApproxBase):
|
|
|
28
34
|
elif isinstance(obj, list):
|
|
29
35
|
return list(recur_repr_helper(o) for o in obj)
|
|
30
36
|
else:
|
|
31
|
-
return self.
|
|
37
|
+
return nested_approx(obj, self.rel, self.abs, self.nan_ok)
|
|
32
38
|
|
|
33
39
|
return "approx({!r})".format(recur_repr_helper(self.expected))
|
|
34
40
|
|
|
35
|
-
def _approx_scalar(self, x) -> ApproxScalar:
|
|
36
|
-
if isinstance(x, Decimal):
|
|
37
|
-
return ApproxDecimal(x, to_decimal(self.rel), to_decimal(self.abs), self.nan_ok)
|
|
38
|
-
return ApproxScalar(x, self.rel, self.abs, self.nan_ok)
|
|
39
|
-
|
|
40
|
-
def _check_type(self):
|
|
41
|
-
pass
|
|
42
|
-
|
|
43
41
|
|
|
44
42
|
class ApproxNestedSequenceLike(ApproxNestedMixin, ApproxSequenceLike):
|
|
45
43
|
|
|
46
|
-
def
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
def __eq__(self, actual):
|
|
45
|
+
if not isinstance(actual, (list, tuple)) or len(actual) != len(self.expected):
|
|
46
|
+
return False
|
|
47
|
+
return all(
|
|
48
|
+
value == nested_approx(expected, self.rel, self.abs, self.nan_ok)
|
|
49
|
+
for value, expected in zip(actual, self.expected)
|
|
50
|
+
)
|
|
53
51
|
|
|
54
52
|
|
|
55
53
|
class ApproxNestedMapping(ApproxNestedMixin, ApproxMapping):
|
|
56
54
|
|
|
57
|
-
def
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
def __eq__(self, actual):
|
|
56
|
+
if not isinstance(actual, dict) or actual.keys() != self.expected.keys():
|
|
57
|
+
return False
|
|
58
|
+
return all(
|
|
59
|
+
actual[key] == nested_approx(expected, self.rel, self.abs, self.nan_ok)
|
|
60
|
+
for key, expected in self.expected.items()
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class ApproxDataTime(pytest.Approx):
|
|
65
|
+
|
|
66
|
+
def __repr__(self) -> str:
|
|
67
|
+
return f"approx({self.expected!r})"
|
|
68
|
+
|
|
69
|
+
def __eq__(self, actual) -> bool:
|
|
70
|
+
return actual == self.expected
|
|
64
71
|
|
|
65
72
|
|
|
66
|
-
def nested_approx(
|
|
73
|
+
def nested_approx(
|
|
74
|
+
expected,
|
|
75
|
+
rel: SupportApprox = None,
|
|
76
|
+
abs: SupportApprox = None,
|
|
77
|
+
nan_ok: bool = False,
|
|
78
|
+
) -> pytest.Approx:
|
|
79
|
+
if expected is None or isinstance(expected, str):
|
|
80
|
+
return pytest.approx(expected, nan_ok=nan_ok)
|
|
67
81
|
if isinstance(expected, dict):
|
|
68
82
|
return ApproxNestedMapping(expected, rel, abs, nan_ok)
|
|
69
83
|
if isinstance(expected, (tuple, list)):
|
|
@@ -71,7 +85,7 @@ def nested_approx(expected, rel: float = None, abs: float = None, nan_ok: bool =
|
|
|
71
85
|
if isinstance(expected, Decimal):
|
|
72
86
|
return ApproxDecimal(expected, to_decimal(rel), to_decimal(abs), nan_ok)
|
|
73
87
|
if isinstance(expected, (datetime.datetime, datetime.date, datetime.time, datetime.timedelta)):
|
|
74
|
-
return
|
|
88
|
+
return ApproxDataTime(expected, rel, abs, nan_ok)
|
|
75
89
|
return pytest.approx(expected, rel=rel, abs=abs, nan_ok=nan_ok)
|
|
76
90
|
|
|
77
91
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plexus-python-common
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.92
|
|
4
4
|
Classifier: Programming Language :: Python :: 3
|
|
5
5
|
Classifier: Programming Language :: Python :: 3.12
|
|
6
6
|
Classifier: Programming Language :: Python :: 3.13
|
|
@@ -20,4 +20,4 @@ Requires-Dist: pytest-cov>=5.0; extra == "test"
|
|
|
20
20
|
Requires-Dist: pytest-mysql>=3.0; extra == "test"
|
|
21
21
|
Requires-Dist: pytest-order>=1.3; extra == "test"
|
|
22
22
|
Requires-Dist: pytest-postgresql>=6.1; extra == "test"
|
|
23
|
-
Requires-Dist: pytest>=
|
|
23
|
+
Requires-Dist: pytest>=9.2; extra == "test"
|
|
@@ -311,6 +311,25 @@ class TestUtilsTest(unittest.TestCase):
|
|
|
311
311
|
assert expect == nested_approx(actual, abs=1.00001e-6)
|
|
312
312
|
assert actual == nested_approx(expect, abs=1.00001e-6)
|
|
313
313
|
|
|
314
|
+
data_nested_approx__structure_mismatch = [
|
|
315
|
+
([[]], [[1]]),
|
|
316
|
+
([[1]], [[]]),
|
|
317
|
+
([[1]], [[1, 2]]),
|
|
318
|
+
([{}], [{"extra": 1}]),
|
|
319
|
+
([{"a": 1}], [{}]),
|
|
320
|
+
([{"a": 1}], [{"b": 1}]),
|
|
321
|
+
({"nested": []}, {"nested": {}}),
|
|
322
|
+
({"nested": [1]}, {"nested": None}),
|
|
323
|
+
({"nested": {"a": 1}}, {"nested": [1]}),
|
|
324
|
+
]
|
|
325
|
+
|
|
326
|
+
@ddt.idata(data_nested_approx__structure_mismatch)
|
|
327
|
+
@ddt.unpack
|
|
328
|
+
def test_nested_approx__structure_mismatch(self, expect, actual):
|
|
329
|
+
self.assertFalse(actual == nested_approx(expect))
|
|
330
|
+
self.assertFalse(expect == nested_approx(actual))
|
|
331
|
+
self.assertTrue(actual != nested_approx(expect))
|
|
332
|
+
|
|
314
333
|
def test_return_callee(self):
|
|
315
334
|
callee = return_callee()
|
|
316
335
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/config/config.cfg
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/csvutils/data.csv
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/resources/unittest/csvutils/data.tsv
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/__init__.py
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/argutils.py
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/config.py
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/csvutils.py
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/dbutils.py
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/dtutils.py
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/funcutils.py
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/iterutils.py
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/jsonutils.py
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/logger.py
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/numutils.py
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/pathutils.py
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/randutils.py
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/retry.py
RENAMED
|
File without changes
|
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/strutils.py
RENAMED
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/src/plexus/common/utils/typeutils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{plexus_python_common-1.1.91 → plexus_python_common-1.1.92}/test/plexus_tests/common/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|