contractme 1.0.0__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.
- contractme-1.0.0/.coverage +0 -0
- contractme-1.0.0/.gitignore +10 -0
- contractme-1.0.0/.gitlab-ci.yml +17 -0
- contractme-1.0.0/.python-version +1 -0
- contractme-1.0.0/LICENSE +201 -0
- contractme-1.0.0/PKG-INFO +42 -0
- contractme-1.0.0/README.md +33 -0
- contractme-1.0.0/pyproject.toml +20 -0
- contractme-1.0.0/src/contractme/__init__.py +4 -0
- contractme-1.0.0/src/contractme/contracting.py +237 -0
- contractme-1.0.0/src/contractme/py.typed +0 -0
- contractme-1.0.0/tests/test_contracting.py +150 -0
- contractme-1.0.0/uv.lock +115 -0
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
variables:
|
|
2
|
+
UV_VERSION: 0.5
|
|
3
|
+
PYTHON_VERSION: 3.12
|
|
4
|
+
BASE_LAYER: bookworm-slim
|
|
5
|
+
# GitLab CI creates a separate mountpoint for the build directory,
|
|
6
|
+
# so we need to copy instead of using hard links.
|
|
7
|
+
UV_LINK_MODE: copy
|
|
8
|
+
|
|
9
|
+
tests:
|
|
10
|
+
image: ghcr.io/astral-sh/uv:$UV_VERSION-python$PYTHON_VERSION-$BASE_LAYER
|
|
11
|
+
script:
|
|
12
|
+
uv run pytest --cov=dbc --cov-report term --cov-report xml:cov.xml
|
|
13
|
+
artifacts:
|
|
14
|
+
reports:
|
|
15
|
+
coverage_report:
|
|
16
|
+
coverage_format: cobertura
|
|
17
|
+
path: cov.xml
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
contractme-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 Léo GERMOND
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: contractme
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A powerful, expressive and lightweight design-by-contract framework
|
|
5
|
+
Author-email: Leo Germond <leo.germond@gmail.com>
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.13
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# ContractMe
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
A lightweight and adaptable framework for design-by-contract in python
|
|
15
|
+
|
|
16
|
+
# Example code
|
|
17
|
+
|
|
18
|
+
Here are some examples:
|
|
19
|
+
|
|
20
|
+
## `result`
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
@precondition(lambda x: x >= 0)
|
|
24
|
+
@postcondition(lambda x, result: eps_eq(result * result, x))
|
|
25
|
+
def square_root(x: float) -> float:
|
|
26
|
+
return x**0.5
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## `old`
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
@precondition(lambda l, n: n >= 0 and round(n) == n)
|
|
33
|
+
@postcondition(lambda l, n: len(l) > 0)
|
|
34
|
+
@postcondition(lambda l, n: l[-1] == n)
|
|
35
|
+
@postcondition(lambda l, n, old: l[:-1] == old.l)
|
|
36
|
+
def append_count(l: list[int], n: int):
|
|
37
|
+
l.append(n)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
# Test
|
|
41
|
+
|
|
42
|
+
`uv run pytest`
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# ContractMe
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
A lightweight and adaptable framework for design-by-contract in python
|
|
6
|
+
|
|
7
|
+
# Example code
|
|
8
|
+
|
|
9
|
+
Here are some examples:
|
|
10
|
+
|
|
11
|
+
## `result`
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
@precondition(lambda x: x >= 0)
|
|
15
|
+
@postcondition(lambda x, result: eps_eq(result * result, x))
|
|
16
|
+
def square_root(x: float) -> float:
|
|
17
|
+
return x**0.5
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## `old`
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
@precondition(lambda l, n: n >= 0 and round(n) == n)
|
|
24
|
+
@postcondition(lambda l, n: len(l) > 0)
|
|
25
|
+
@postcondition(lambda l, n: l[-1] == n)
|
|
26
|
+
@postcondition(lambda l, n, old: l[:-1] == old.l)
|
|
27
|
+
def append_count(l: list[int], n: int):
|
|
28
|
+
l.append(n)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
# Test
|
|
32
|
+
|
|
33
|
+
`uv run pytest`
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "contractme"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "A powerful, expressive and lightweight design-by-contract framework"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Leo Germond", email = "leo.germond@gmail.com" }
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.13"
|
|
10
|
+
dependencies = []
|
|
11
|
+
|
|
12
|
+
[build-system]
|
|
13
|
+
requires = ["hatchling"]
|
|
14
|
+
build-backend = "hatchling.build"
|
|
15
|
+
|
|
16
|
+
[dependency-groups]
|
|
17
|
+
dev = [
|
|
18
|
+
"pytest>=8.3.5",
|
|
19
|
+
"pytest-cov>=6.0.0",
|
|
20
|
+
]
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import inspect
|
|
2
|
+
from functools import wraps
|
|
3
|
+
import copy
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def show_source(f):
|
|
7
|
+
def get_fn_name(f):
|
|
8
|
+
return f.__code__.co_name
|
|
9
|
+
|
|
10
|
+
def get_source_for_lambda(s):
|
|
11
|
+
fst = s.index("lambda")
|
|
12
|
+
if "(" in s:
|
|
13
|
+
nxt = s.index("(")
|
|
14
|
+
if nxt < fst:
|
|
15
|
+
fst = nxt
|
|
16
|
+
else:
|
|
17
|
+
fst = 0
|
|
18
|
+
|
|
19
|
+
def cpar_index(s):
|
|
20
|
+
p = 0
|
|
21
|
+
for n, c in enumerate(s):
|
|
22
|
+
if c == "(":
|
|
23
|
+
p += 1
|
|
24
|
+
elif c == ")":
|
|
25
|
+
p -= 1
|
|
26
|
+
assert p >= 0
|
|
27
|
+
if p == 0:
|
|
28
|
+
break
|
|
29
|
+
return n
|
|
30
|
+
|
|
31
|
+
lst = cpar_index(s[fst:]) + fst
|
|
32
|
+
assert fst < lst
|
|
33
|
+
in_par = s[fst:lst]
|
|
34
|
+
fst = s.index("lambda", fst)
|
|
35
|
+
fst = s.index(":", fst) + 1
|
|
36
|
+
assert fst < lst
|
|
37
|
+
return s[fst:lst].strip()
|
|
38
|
+
|
|
39
|
+
s = inspect.getsource(f)
|
|
40
|
+
if s.lstrip().startswith("def "):
|
|
41
|
+
return get_fn_name(f)
|
|
42
|
+
elif "lambda" in s:
|
|
43
|
+
return get_source_for_lambda(s)
|
|
44
|
+
else: # pragma: no cover
|
|
45
|
+
# Not reachable?
|
|
46
|
+
raise Exception(f"impossible to parse source {s}")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def get_wraparound(f):
|
|
50
|
+
if hasattr(f, "dbc_wraparound"):
|
|
51
|
+
result = f.dbc_wraparound, f.dbc_preconditions, f.dbc_postconditions
|
|
52
|
+
else:
|
|
53
|
+
result = f, [], []
|
|
54
|
+
return result
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def set_wraparound(f, original_call, preconditions, postconditions):
|
|
58
|
+
f.dbc_wraparound = original_call
|
|
59
|
+
f.dbc_preconditions = preconditions
|
|
60
|
+
f.dbc_postconditions = postconditions
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def assert_argspec_and_kw_match(argspec, kw, ignore=None):
|
|
64
|
+
assert all(
|
|
65
|
+
a in kw for a in argspec.args if not ignore or a not in ignore
|
|
66
|
+
), f"missing arg in {list(kw)} for {argspec.args}"
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def get_kw_from_call(f, a, kw):
|
|
70
|
+
argspec = inspect.getfullargspec(f)
|
|
71
|
+
|
|
72
|
+
kw2 = kw.copy()
|
|
73
|
+
# kwargs
|
|
74
|
+
for i, nm in enumerate(argspec.args):
|
|
75
|
+
# positionals
|
|
76
|
+
if len(a) > i:
|
|
77
|
+
v = a[i]
|
|
78
|
+
kw2[nm] = v
|
|
79
|
+
|
|
80
|
+
for i, nm in enumerate(a for a in argspec.args if a not in kw2):
|
|
81
|
+
# defaults
|
|
82
|
+
kw2[nm] = argspec.defaults[i]
|
|
83
|
+
|
|
84
|
+
assert_argspec_and_kw_match(argspec, kw2)
|
|
85
|
+
return kw2
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def format_kw(kw):
|
|
89
|
+
def brief_repr(o, length):
|
|
90
|
+
r = repr(o)
|
|
91
|
+
if len(r) > length:
|
|
92
|
+
half = 1 + ((length - 5 + 1) // 2)
|
|
93
|
+
r = f"{r[:half]}[...]{r[-half:]}"
|
|
94
|
+
return r
|
|
95
|
+
|
|
96
|
+
return ", ".join(f"{k} = {brief_repr(kw[k], 30)}" for k in sorted(kw))
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class OldHolder:
|
|
100
|
+
def __init__(self, d):
|
|
101
|
+
self.d = copy.deepcopy(d)
|
|
102
|
+
|
|
103
|
+
def __getattr__(self, name):
|
|
104
|
+
return self.d[name]
|
|
105
|
+
|
|
106
|
+
def __repr__(self):
|
|
107
|
+
return repr(self.d)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
PRE, PRE_INIT, POST = 1, 2, 3
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def get_kw_for_conditional_before(cond_type, conditional, in_kw):
|
|
114
|
+
assert cond_type in (PRE, PRE_INIT, POST)
|
|
115
|
+
assert callable(conditional)
|
|
116
|
+
out_kw = {}
|
|
117
|
+
argspec = inspect.getfullargspec(conditional)
|
|
118
|
+
for nm in argspec.args:
|
|
119
|
+
if nm == "result":
|
|
120
|
+
assert cond_type == POST, f"only postconditions can use {nm!r}"
|
|
121
|
+
elif nm == "old":
|
|
122
|
+
assert cond_type == POST, f"only postconditions can use {nm!r}"
|
|
123
|
+
out_kw[nm] = OldHolder(in_kw)
|
|
124
|
+
else:
|
|
125
|
+
if nm == "self":
|
|
126
|
+
assert (
|
|
127
|
+
cond_type != PRE_INIT
|
|
128
|
+
), f"precondition of a constructor cannot use {nm!r}"
|
|
129
|
+
out_kw[nm] = in_kw[nm]
|
|
130
|
+
assert_argspec_and_kw_match(argspec, out_kw, ("result",))
|
|
131
|
+
return out_kw
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def get_kw_for_postcondition_after(result, conditional, in_kw):
|
|
135
|
+
assert callable(conditional)
|
|
136
|
+
out_kw = {}
|
|
137
|
+
argspec = inspect.getfullargspec(conditional)
|
|
138
|
+
if "result" in argspec.args:
|
|
139
|
+
out_kw["result"] = result
|
|
140
|
+
assert ("result" in out_kw) == ("result" in argspec.args)
|
|
141
|
+
return out_kw
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def condition_decorator(is_precondition, conditional, message=None):
|
|
145
|
+
def deco(f):
|
|
146
|
+
original_call, preconditions, postconditions = get_wraparound(f)
|
|
147
|
+
|
|
148
|
+
if is_precondition:
|
|
149
|
+
preconditions.insert(0, (conditional, message))
|
|
150
|
+
else:
|
|
151
|
+
postconditions.insert(0, (conditional, message))
|
|
152
|
+
|
|
153
|
+
def rejects_call_kw(call_kw, stop_at_first_rejection: bool = False) -> list:
|
|
154
|
+
rejection_reasons = []
|
|
155
|
+
for precondition, message in preconditions:
|
|
156
|
+
cond_type = PRE_INIT if original_call.__name__ == "__init__" else PRE
|
|
157
|
+
cond_kw = get_kw_for_conditional_before(
|
|
158
|
+
cond_type, precondition, call_kw
|
|
159
|
+
)
|
|
160
|
+
if not precondition(**cond_kw):
|
|
161
|
+
cond_kw_str = format_kw(cond_kw)
|
|
162
|
+
src = show_source(precondition)
|
|
163
|
+
if message is None:
|
|
164
|
+
rejection_reasons.append(
|
|
165
|
+
f"**caller** of {original_call.__name__}() bug: precondition {src!r} failed: {cond_kw_str}"
|
|
166
|
+
)
|
|
167
|
+
else:
|
|
168
|
+
rejection_reasons.append(
|
|
169
|
+
f"**caller** of {original_call.__name__}() bug: precondition {message!r} failed: {cond_kw_str}"
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
if stop_at_first_rejection:
|
|
173
|
+
break
|
|
174
|
+
|
|
175
|
+
return rejection_reasons
|
|
176
|
+
|
|
177
|
+
def rejects(*a, **kw) -> bool:
|
|
178
|
+
call_kw = get_kw_from_call(original_call, a, kw)
|
|
179
|
+
return bool(rejects_call_kw(call_kw, stop_at_first_rejection=True))
|
|
180
|
+
|
|
181
|
+
def accepts(*a, **kw) -> bool:
|
|
182
|
+
call_kw = get_kw_from_call(original_call, a, kw)
|
|
183
|
+
return not rejects_call_kw(call_kw, stop_at_first_rejection=True)
|
|
184
|
+
|
|
185
|
+
@wraps(f)
|
|
186
|
+
def call_and_run_contracts(*a, **kw):
|
|
187
|
+
call_kw = get_kw_from_call(original_call, a, kw)
|
|
188
|
+
|
|
189
|
+
reasons = rejects_call_kw(call_kw, stop_at_first_rejection=False)
|
|
190
|
+
if reasons:
|
|
191
|
+
raise AssertionError(reasons[0])
|
|
192
|
+
|
|
193
|
+
post_kw = []
|
|
194
|
+
for postcondition, _ in postconditions:
|
|
195
|
+
cond_kw = get_kw_for_conditional_before(POST, postcondition, call_kw)
|
|
196
|
+
post_kw.append(cond_kw)
|
|
197
|
+
|
|
198
|
+
result = original_call(*a, **kw)
|
|
199
|
+
|
|
200
|
+
for i, (postcondition, message) in enumerate(postconditions):
|
|
201
|
+
cond_kw = post_kw[i]
|
|
202
|
+
cond_kw.update(
|
|
203
|
+
get_kw_for_postcondition_after(result, postcondition, call_kw)
|
|
204
|
+
)
|
|
205
|
+
if not postcondition(**cond_kw):
|
|
206
|
+
cond_kw_str = format_kw(cond_kw)
|
|
207
|
+
src = show_source(postcondition)
|
|
208
|
+
if message is None:
|
|
209
|
+
raise AssertionError(
|
|
210
|
+
f"{original_call.__name__}() bug: postcondition {src!r} failed: {cond_kw_str}"
|
|
211
|
+
)
|
|
212
|
+
else:
|
|
213
|
+
raise AssertionError(
|
|
214
|
+
f"{original_call.__name__}() bug: postcondition {message!r} failed: {cond_kw_str}"
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
return result
|
|
218
|
+
|
|
219
|
+
set_wraparound(
|
|
220
|
+
call_and_run_contracts, original_call, preconditions, postconditions
|
|
221
|
+
)
|
|
222
|
+
call_and_run_contracts.accepts = accepts
|
|
223
|
+
call_and_run_contracts.rejects = rejects
|
|
224
|
+
return call_and_run_contracts
|
|
225
|
+
|
|
226
|
+
return deco
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
def precondition(conditional, message=None):
|
|
230
|
+
return condition_decorator(True, conditional, message)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def postcondition(conditional, message=None):
|
|
234
|
+
return condition_decorator(False, conditional, message)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
never_returns = postcondition(lambda: False, "should never return")
|
|
File without changes
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from contractme import precondition, postcondition
|
|
3
|
+
|
|
4
|
+
def eps_eq(a, b):
|
|
5
|
+
return abs(a - b) <= 1e-7 * min(abs(a), abs(b))
|
|
6
|
+
|
|
7
|
+
def test_square_root():
|
|
8
|
+
@precondition(lambda x: x > 0)
|
|
9
|
+
@postcondition(lambda x, result: eps_eq(result * result, x))
|
|
10
|
+
def square_root(x: float) -> float:
|
|
11
|
+
return x**0.5
|
|
12
|
+
|
|
13
|
+
for v in (1, 4, 9, 16, 2):
|
|
14
|
+
_ = square_root(v)
|
|
15
|
+
|
|
16
|
+
for v in (-1, -2, -4):
|
|
17
|
+
with pytest.raises(AssertionError):
|
|
18
|
+
_ = square_root(v)
|
|
19
|
+
|
|
20
|
+
def test_append():
|
|
21
|
+
@precondition(lambda n: n >= 0 and round(n) == n)
|
|
22
|
+
@postcondition(lambda l: len(l) > 0)
|
|
23
|
+
@postcondition(lambda l, n: l[-1] == n)
|
|
24
|
+
@postcondition(lambda l, old: l[:-1] == old.l)
|
|
25
|
+
def append_count(l: list[int], n: int):
|
|
26
|
+
l.append(n)
|
|
27
|
+
|
|
28
|
+
a: list[int] = []
|
|
29
|
+
append_count(a, 2)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_no_append_count():
|
|
33
|
+
@precondition(lambda l: hasattr(l, "__len__"))
|
|
34
|
+
@precondition(lambda n: n >= 0 and round(n) == n)
|
|
35
|
+
@postcondition(lambda l: hasattr(l, "__len__"))
|
|
36
|
+
@postcondition(lambda l: len(l) > 0)
|
|
37
|
+
@postcondition(lambda l, n: l[-1] == n)
|
|
38
|
+
@postcondition(lambda l, old: l[:-1] == old.l)
|
|
39
|
+
def buggy_append_count(l, n):
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
with pytest.raises(AssertionError):
|
|
43
|
+
buggy_append_count(None, 2)
|
|
44
|
+
with pytest.raises(AssertionError):
|
|
45
|
+
buggy_append_count([], 2)
|
|
46
|
+
|
|
47
|
+
def test_printout_error_messages():
|
|
48
|
+
|
|
49
|
+
# parsing when parentheses are not before the lambda kw
|
|
50
|
+
@precondition (
|
|
51
|
+
lambda a: (False)
|
|
52
|
+
)
|
|
53
|
+
def f(a): # pragma: no cover
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
with pytest.raises(AssertionError):
|
|
57
|
+
f(None)
|
|
58
|
+
|
|
59
|
+
# parsing with a var that is a lambda
|
|
60
|
+
cond = lambda a: False
|
|
61
|
+
@precondition (cond)
|
|
62
|
+
def f(a): # pragma: no cover
|
|
63
|
+
pass
|
|
64
|
+
|
|
65
|
+
with pytest.raises(AssertionError):
|
|
66
|
+
f(None)
|
|
67
|
+
|
|
68
|
+
def test_rejects_accepts():
|
|
69
|
+
@precondition(lambda a: a > 0)
|
|
70
|
+
def f(a): # pragma: no cover
|
|
71
|
+
pass
|
|
72
|
+
|
|
73
|
+
assert f.rejects(0)
|
|
74
|
+
assert f.accepts(1)
|
|
75
|
+
|
|
76
|
+
def test_with_global():
|
|
77
|
+
count = 0
|
|
78
|
+
def count_is_reset() -> bool:
|
|
79
|
+
return count == 0
|
|
80
|
+
|
|
81
|
+
@postcondition(count_is_reset)
|
|
82
|
+
def reset_count():
|
|
83
|
+
nonlocal count
|
|
84
|
+
count = 0
|
|
85
|
+
|
|
86
|
+
@postcondition(count_is_reset)
|
|
87
|
+
def failing_reset_count():
|
|
88
|
+
pass
|
|
89
|
+
|
|
90
|
+
count = 1
|
|
91
|
+
with pytest.raises(AssertionError):
|
|
92
|
+
failing_reset_count()
|
|
93
|
+
reset_count()
|
|
94
|
+
|
|
95
|
+
def test_call_with_default():
|
|
96
|
+
@precondition(lambda a: a > 0)
|
|
97
|
+
def f(a=1, b=2, c=3):
|
|
98
|
+
pass
|
|
99
|
+
|
|
100
|
+
f()
|
|
101
|
+
|
|
102
|
+
def test_failing_pre_with_message():
|
|
103
|
+
@precondition(lambda: False, "message that should be displayed")
|
|
104
|
+
def f(): # pragma: no cover
|
|
105
|
+
pass
|
|
106
|
+
|
|
107
|
+
with pytest.raises(AssertionError):
|
|
108
|
+
f()
|
|
109
|
+
|
|
110
|
+
def test_failing_post_with_message():
|
|
111
|
+
@postcondition(lambda: False, "message that should be displayed")
|
|
112
|
+
def f():
|
|
113
|
+
pass
|
|
114
|
+
|
|
115
|
+
with pytest.raises(AssertionError):
|
|
116
|
+
f()
|
|
117
|
+
|
|
118
|
+
def test_rejects_accepts_with_message():
|
|
119
|
+
@precondition(lambda a: a > 0, "message that should be displayed")
|
|
120
|
+
def f(a):
|
|
121
|
+
pass
|
|
122
|
+
|
|
123
|
+
f(1)
|
|
124
|
+
assert f.rejects(0)
|
|
125
|
+
assert f.accepts(1)
|
|
126
|
+
|
|
127
|
+
def test_failing_post_with_old():
|
|
128
|
+
@postcondition(lambda l, old: len(l) > len(old.l))
|
|
129
|
+
def f(l):
|
|
130
|
+
pass
|
|
131
|
+
|
|
132
|
+
with pytest.raises(AssertionError):
|
|
133
|
+
f([])
|
|
134
|
+
|
|
135
|
+
def test_call_with_long_argument_that_requires_shorter_repr():
|
|
136
|
+
@precondition(lambda a: False)
|
|
137
|
+
def f(a): # pragma: no cover
|
|
138
|
+
pass
|
|
139
|
+
|
|
140
|
+
with pytest.raises(AssertionError):
|
|
141
|
+
f("Myh very long argument, I can't believe how long it is, what am I gonna do my console is going to be a mess")
|
|
142
|
+
|
|
143
|
+
def test_cannot_have_precondition_of_a_constructor():
|
|
144
|
+
class C:
|
|
145
|
+
@precondition(lambda self: True)
|
|
146
|
+
def __init__(self): # pragma: no cover
|
|
147
|
+
pass
|
|
148
|
+
|
|
149
|
+
with pytest.raises(AssertionError):
|
|
150
|
+
C()
|
contractme-1.0.0/uv.lock
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
version = 1
|
|
2
|
+
revision = 1
|
|
3
|
+
requires-python = ">=3.13"
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "colorama"
|
|
7
|
+
version = "0.4.6"
|
|
8
|
+
source = { registry = "https://pypi.org/simple" }
|
|
9
|
+
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 }
|
|
10
|
+
wheels = [
|
|
11
|
+
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 },
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[[package]]
|
|
15
|
+
name = "contractme"
|
|
16
|
+
version = "1.0.0"
|
|
17
|
+
source = { editable = "." }
|
|
18
|
+
|
|
19
|
+
[package.dev-dependencies]
|
|
20
|
+
dev = [
|
|
21
|
+
{ name = "pytest" },
|
|
22
|
+
{ name = "pytest-cov" },
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[package.metadata]
|
|
26
|
+
|
|
27
|
+
[package.metadata.requires-dev]
|
|
28
|
+
dev = [
|
|
29
|
+
{ name = "pytest", specifier = ">=8.3.5" },
|
|
30
|
+
{ name = "pytest-cov", specifier = ">=6.0.0" },
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[[package]]
|
|
34
|
+
name = "coverage"
|
|
35
|
+
version = "7.6.12"
|
|
36
|
+
source = { registry = "https://pypi.org/simple" }
|
|
37
|
+
sdist = { url = "https://files.pythonhosted.org/packages/0c/d6/2b53ab3ee99f2262e6f0b8369a43f6d66658eab45510331c0b3d5c8c4272/coverage-7.6.12.tar.gz", hash = "sha256:48cfc4641d95d34766ad41d9573cc0f22a48aa88d22657a1fe01dca0dbae4de2", size = 805941 }
|
|
38
|
+
wheels = [
|
|
39
|
+
{ url = "https://files.pythonhosted.org/packages/76/89/1adf3e634753c0de3dad2f02aac1e73dba58bc5a3a914ac94a25b2ef418f/coverage-7.6.12-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:488c27b3db0ebee97a830e6b5a3ea930c4a6e2c07f27a5e67e1b3532e76b9ef1", size = 208673 },
|
|
40
|
+
{ url = "https://files.pythonhosted.org/packages/ce/64/92a4e239d64d798535c5b45baac6b891c205a8a2e7c9cc8590ad386693dc/coverage-7.6.12-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:5d1095bbee1851269f79fd8e0c9b5544e4c00c0c24965e66d8cba2eb5bb535fd", size = 208945 },
|
|
41
|
+
{ url = "https://files.pythonhosted.org/packages/b4/d0/4596a3ef3bca20a94539c9b1e10fd250225d1dec57ea78b0867a1cf9742e/coverage-7.6.12-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0533adc29adf6a69c1baa88c3d7dbcaadcffa21afbed3ca7a225a440e4744bf9", size = 242484 },
|
|
42
|
+
{ url = "https://files.pythonhosted.org/packages/1c/ef/6fd0d344695af6718a38d0861408af48a709327335486a7ad7e85936dc6e/coverage-7.6.12-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:53c56358d470fa507a2b6e67a68fd002364d23c83741dbc4c2e0680d80ca227e", size = 239525 },
|
|
43
|
+
{ url = "https://files.pythonhosted.org/packages/0c/4b/373be2be7dd42f2bcd6964059fd8fa307d265a29d2b9bcf1d044bcc156ed/coverage-7.6.12-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:64cbb1a3027c79ca6310bf101014614f6e6e18c226474606cf725238cf5bc2d4", size = 241545 },
|
|
44
|
+
{ url = "https://files.pythonhosted.org/packages/a6/7d/0e83cc2673a7790650851ee92f72a343827ecaaea07960587c8f442b5cd3/coverage-7.6.12-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:79cac3390bfa9836bb795be377395f28410811c9066bc4eefd8015258a7578c6", size = 241179 },
|
|
45
|
+
{ url = "https://files.pythonhosted.org/packages/ff/8c/566ea92ce2bb7627b0900124e24a99f9244b6c8c92d09ff9f7633eb7c3c8/coverage-7.6.12-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:9b148068e881faa26d878ff63e79650e208e95cf1c22bd3f77c3ca7b1d9821a3", size = 239288 },
|
|
46
|
+
{ url = "https://files.pythonhosted.org/packages/7d/e4/869a138e50b622f796782d642c15fb5f25a5870c6d0059a663667a201638/coverage-7.6.12-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:8bec2ac5da793c2685ce5319ca9bcf4eee683b8a1679051f8e6ec04c4f2fd7dc", size = 241032 },
|
|
47
|
+
{ url = "https://files.pythonhosted.org/packages/ae/28/a52ff5d62a9f9e9fe9c4f17759b98632edd3a3489fce70154c7d66054dd3/coverage-7.6.12-cp313-cp313-win32.whl", hash = "sha256:200e10beb6ddd7c3ded322a4186313d5ca9e63e33d8fab4faa67ef46d3460af3", size = 211315 },
|
|
48
|
+
{ url = "https://files.pythonhosted.org/packages/bc/17/ab849b7429a639f9722fa5628364c28d675c7ff37ebc3268fe9840dda13c/coverage-7.6.12-cp313-cp313-win_amd64.whl", hash = "sha256:2b996819ced9f7dbb812c701485d58f261bef08f9b85304d41219b1496b591ef", size = 212099 },
|
|
49
|
+
{ url = "https://files.pythonhosted.org/packages/d2/1c/b9965bf23e171d98505eb5eb4fb4d05c44efd256f2e0f19ad1ba8c3f54b0/coverage-7.6.12-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:299cf973a7abff87a30609879c10df0b3bfc33d021e1adabc29138a48888841e", size = 209511 },
|
|
50
|
+
{ url = "https://files.pythonhosted.org/packages/57/b3/119c201d3b692d5e17784fee876a9a78e1b3051327de2709392962877ca8/coverage-7.6.12-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:4b467a8c56974bf06e543e69ad803c6865249d7a5ccf6980457ed2bc50312703", size = 209729 },
|
|
51
|
+
{ url = "https://files.pythonhosted.org/packages/52/4e/a7feb5a56b266304bc59f872ea07b728e14d5a64f1ad3a2cc01a3259c965/coverage-7.6.12-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2458f275944db8129f95d91aee32c828a408481ecde3b30af31d552c2ce284a0", size = 253988 },
|
|
52
|
+
{ url = "https://files.pythonhosted.org/packages/65/19/069fec4d6908d0dae98126aa7ad08ce5130a6decc8509da7740d36e8e8d2/coverage-7.6.12-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0a9d8be07fb0832636a0f72b80d2a652fe665e80e720301fb22b191c3434d924", size = 249697 },
|
|
53
|
+
{ url = "https://files.pythonhosted.org/packages/1c/da/5b19f09ba39df7c55f77820736bf17bbe2416bbf5216a3100ac019e15839/coverage-7.6.12-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14d47376a4f445e9743f6c83291e60adb1b127607a3618e3185bbc8091f0467b", size = 252033 },
|
|
54
|
+
{ url = "https://files.pythonhosted.org/packages/1e/89/4c2750df7f80a7872267f7c5fe497c69d45f688f7b3afe1297e52e33f791/coverage-7.6.12-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:b95574d06aa9d2bd6e5cc35a5bbe35696342c96760b69dc4287dbd5abd4ad51d", size = 251535 },
|
|
55
|
+
{ url = "https://files.pythonhosted.org/packages/78/3b/6d3ae3c1cc05f1b0460c51e6f6dcf567598cbd7c6121e5ad06643974703c/coverage-7.6.12-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:ecea0c38c9079570163d663c0433a9af4094a60aafdca491c6a3d248c7432827", size = 249192 },
|
|
56
|
+
{ url = "https://files.pythonhosted.org/packages/6e/8e/c14a79f535ce41af7d436bbad0d3d90c43d9e38ec409b4770c894031422e/coverage-7.6.12-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:2251fabcfee0a55a8578a9d29cecfee5f2de02f11530e7d5c5a05859aa85aee9", size = 250627 },
|
|
57
|
+
{ url = "https://files.pythonhosted.org/packages/cb/79/b7cee656cfb17a7f2c1b9c3cee03dd5d8000ca299ad4038ba64b61a9b044/coverage-7.6.12-cp313-cp313t-win32.whl", hash = "sha256:eb5507795caabd9b2ae3f1adc95f67b1104971c22c624bb354232d65c4fc90b3", size = 212033 },
|
|
58
|
+
{ url = "https://files.pythonhosted.org/packages/b6/c3/f7aaa3813f1fa9a4228175a7bd368199659d392897e184435a3b66408dd3/coverage-7.6.12-cp313-cp313t-win_amd64.whl", hash = "sha256:f60a297c3987c6c02ffb29effc70eadcbb412fe76947d394a1091a3615948e2f", size = 213240 },
|
|
59
|
+
{ url = "https://files.pythonhosted.org/packages/fb/b2/f655700e1024dec98b10ebaafd0cedbc25e40e4abe62a3c8e2ceef4f8f0a/coverage-7.6.12-py3-none-any.whl", hash = "sha256:eb8668cfbc279a536c633137deeb9435d2962caec279c3f8cf8b91fff6ff8953", size = 200552 },
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
[[package]]
|
|
63
|
+
name = "iniconfig"
|
|
64
|
+
version = "2.0.0"
|
|
65
|
+
source = { registry = "https://pypi.org/simple" }
|
|
66
|
+
sdist = { url = "https://files.pythonhosted.org/packages/d7/4b/cbd8e699e64a6f16ca3a8220661b5f83792b3017d0f79807cb8708d33913/iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3", size = 4646 }
|
|
67
|
+
wheels = [
|
|
68
|
+
{ url = "https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374", size = 5892 },
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[[package]]
|
|
72
|
+
name = "packaging"
|
|
73
|
+
version = "24.2"
|
|
74
|
+
source = { registry = "https://pypi.org/simple" }
|
|
75
|
+
sdist = { url = "https://files.pythonhosted.org/packages/d0/63/68dbb6eb2de9cb10ee4c9c14a0148804425e13c4fb20d61cce69f53106da/packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f", size = 163950 }
|
|
76
|
+
wheels = [
|
|
77
|
+
{ url = "https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759", size = 65451 },
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[[package]]
|
|
81
|
+
name = "pluggy"
|
|
82
|
+
version = "1.5.0"
|
|
83
|
+
source = { registry = "https://pypi.org/simple" }
|
|
84
|
+
sdist = { url = "https://files.pythonhosted.org/packages/96/2d/02d4312c973c6050a18b314a5ad0b3210edb65a906f868e31c111dede4a6/pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1", size = 67955 }
|
|
85
|
+
wheels = [
|
|
86
|
+
{ url = "https://files.pythonhosted.org/packages/88/5f/e351af9a41f866ac3f1fac4ca0613908d9a41741cfcf2228f4ad853b697d/pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669", size = 20556 },
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
[[package]]
|
|
90
|
+
name = "pytest"
|
|
91
|
+
version = "8.3.5"
|
|
92
|
+
source = { registry = "https://pypi.org/simple" }
|
|
93
|
+
dependencies = [
|
|
94
|
+
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
|
95
|
+
{ name = "iniconfig" },
|
|
96
|
+
{ name = "packaging" },
|
|
97
|
+
{ name = "pluggy" },
|
|
98
|
+
]
|
|
99
|
+
sdist = { url = "https://files.pythonhosted.org/packages/ae/3c/c9d525a414d506893f0cd8a8d0de7706446213181570cdbd766691164e40/pytest-8.3.5.tar.gz", hash = "sha256:f4efe70cc14e511565ac476b57c279e12a855b11f48f212af1080ef2263d3845", size = 1450891 }
|
|
100
|
+
wheels = [
|
|
101
|
+
{ url = "https://files.pythonhosted.org/packages/30/3d/64ad57c803f1fa1e963a7946b6e0fea4a70df53c1a7fed304586539c2bac/pytest-8.3.5-py3-none-any.whl", hash = "sha256:c69214aa47deac29fad6c2a4f590b9c4a9fdb16a403176fe154b79c0b4d4d820", size = 343634 },
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
[[package]]
|
|
105
|
+
name = "pytest-cov"
|
|
106
|
+
version = "6.0.0"
|
|
107
|
+
source = { registry = "https://pypi.org/simple" }
|
|
108
|
+
dependencies = [
|
|
109
|
+
{ name = "coverage" },
|
|
110
|
+
{ name = "pytest" },
|
|
111
|
+
]
|
|
112
|
+
sdist = { url = "https://files.pythonhosted.org/packages/be/45/9b538de8cef30e17c7b45ef42f538a94889ed6a16f2387a6c89e73220651/pytest-cov-6.0.0.tar.gz", hash = "sha256:fde0b595ca248bb8e2d76f020b465f3b107c9632e6a1d1705f17834c89dcadc0", size = 66945 }
|
|
113
|
+
wheels = [
|
|
114
|
+
{ url = "https://files.pythonhosted.org/packages/36/3b/48e79f2cd6a61dbbd4807b4ed46cb564b4fd50a76166b1c4ea5c1d9e2371/pytest_cov-6.0.0-py3-none-any.whl", hash = "sha256:eee6f1b9e61008bd34975a4d5bab25801eb31898b032dd55addc93e96fcaaa35", size = 22949 },
|
|
115
|
+
]
|