hunterMakesPy 0.3.3__py3-none-any.whl → 0.3.4__py3-none-any.whl
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.
- hunterMakesPy/pytestForYourUse.py +1 -2
- hunterMakesPy/tests/conftest.py +79 -5
- hunterMakesPy/tests/test_coping.py +258 -153
- hunterMakesPy/tests/test_dataStructures.py +250 -69
- hunterMakesPy/tests/test_filesystemToolkit.py +245 -131
- hunterMakesPy/tests/test_parseParameters.py +63 -7
- hunterMakesPy/tests/test_theTypes.py +420 -0
- hunterMakesPy/theTypes.py +2 -4
- {huntermakespy-0.3.3.dist-info → huntermakespy-0.3.4.dist-info}/METADATA +1 -1
- huntermakespy-0.3.4.dist-info/RECORD +21 -0
- huntermakespy-0.3.3.dist-info/RECORD +0 -20
- {huntermakespy-0.3.3.dist-info → huntermakespy-0.3.4.dist-info}/WHEEL +0 -0
- {huntermakespy-0.3.3.dist-info → huntermakespy-0.3.4.dist-info}/licenses/LICENSE +0 -0
- {huntermakespy-0.3.3.dist-info → huntermakespy-0.3.4.dist-info}/top_level.txt +0 -0
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
"""Tests for parameter parsing and validation utilities.
|
|
2
|
+
|
|
3
|
+
(AI generated docstring)
|
|
4
|
+
|
|
5
|
+
This module provides test suites for concurrency limits, integer initialization,
|
|
6
|
+
and string-based boolean parsing.
|
|
7
|
+
|
|
8
|
+
"""
|
|
1
9
|
# pyright: standard
|
|
2
10
|
from collections.abc import Callable, Iterable, Iterator
|
|
3
11
|
from hunterMakesPy import defineConcurrencyLimit, intInnit, oopsieKwargsie
|
|
@@ -66,7 +74,7 @@ def PytestFor_defineConcurrencyLimit(callableToTest: Callable[..., int] = define
|
|
|
66
74
|
testCases: dict[float, int] = {
|
|
67
75
|
0.5: cpuCount // 2,
|
|
68
76
|
0.25: cpuCount // 4,
|
|
69
|
-
0.75: int(cpuCount * 0.75)
|
|
77
|
+
0.75: int(cpuCount * 0.75),
|
|
70
78
|
}
|
|
71
79
|
for limit, expected in testCases.items():
|
|
72
80
|
assert callableToTest(limit=limit, cpuTotal=cpuCount) == expected
|
|
@@ -114,7 +122,7 @@ def PytestFor_defineConcurrencyLimit(callableToTest: Callable[..., int] = define
|
|
|
114
122
|
('testStringNumbers', testStringNumbers)
|
|
115
123
|
]
|
|
116
124
|
|
|
117
|
-
def PytestFor_intInnit(callableToTest: Callable[[Iterable[
|
|
125
|
+
def PytestFor_intInnit(callableToTest: Callable[[Iterable[Any], str | None, type[Any] | None], list[int]] = intInnit) -> list[tuple[str, Callable[[], None]]]:
|
|
118
126
|
"""Return a list of test functions to validate integer initialization behavior.
|
|
119
127
|
|
|
120
128
|
This function provides a comprehensive test suite for validating integer parsing
|
|
@@ -222,7 +230,7 @@ def PytestFor_intInnit(callableToTest: Callable[[Iterable[int], str | None, type
|
|
|
222
230
|
def __iter__(self) -> Iterator[int]:
|
|
223
231
|
self.append(89)
|
|
224
232
|
return super().__iter__()
|
|
225
|
-
with pytest.raises(RuntimeError, match=".*modified during iteration.*"):
|
|
233
|
+
with pytest.raises(RuntimeError, match=r".*modified during iteration.*"):
|
|
226
234
|
callableToTest(MutableList([13, 21, 34]), 'test', None)
|
|
227
235
|
|
|
228
236
|
def testHandlesComplexIntegers() -> None:
|
|
@@ -252,7 +260,7 @@ def PytestFor_intInnit(callableToTest: Callable[[Iterable[int], str | None, type
|
|
|
252
260
|
('testRejectsInvalidComplex', testRejectsInvalidComplex)
|
|
253
261
|
]
|
|
254
262
|
|
|
255
|
-
def PytestFor_oopsieKwargsie(callableToTest: Callable[[
|
|
263
|
+
def PytestFor_oopsieKwargsie(callableToTest: Callable[[Any], object] = oopsieKwargsie) -> list[tuple[str, Callable[[], None]]]:
|
|
256
264
|
"""Return a list of test functions to validate string-to-boolean/None conversion behavior.
|
|
257
265
|
|
|
258
266
|
This function provides a comprehensive test suite for validating string parsing and conversion
|
|
@@ -311,13 +319,13 @@ def PytestFor_oopsieKwargsie(callableToTest: Callable[[str], bool | None | str]
|
|
|
311
319
|
def testHandlesNonStringObjects() -> None:
|
|
312
320
|
class NeverGonnaStringIt:
|
|
313
321
|
def __str__(self) -> NoReturn:
|
|
314
|
-
message = "Cannot be stringified"
|
|
322
|
+
message: str = "Cannot be stringified"
|
|
315
323
|
raise TypeError(message)
|
|
316
324
|
|
|
317
325
|
assert callableToTest(123) == "123"
|
|
318
326
|
|
|
319
|
-
neverGonnaStringIt = NeverGonnaStringIt()
|
|
320
|
-
result = callableToTest(neverGonnaStringIt)
|
|
327
|
+
neverGonnaStringIt: NeverGonnaStringIt = NeverGonnaStringIt()
|
|
328
|
+
result: object = callableToTest(neverGonnaStringIt)
|
|
321
329
|
assert result is neverGonnaStringIt
|
|
322
330
|
|
|
323
331
|
return [
|
|
@@ -330,12 +338,60 @@ def PytestFor_oopsieKwargsie(callableToTest: Callable[[str], bool | None | str]
|
|
|
330
338
|
|
|
331
339
|
@pytest.mark.parametrize("nameOfTest,aPytest", PytestFor_defineConcurrencyLimit())
|
|
332
340
|
def testConcurrencyLimit(nameOfTest: str, aPytest: Callable[parameters, returnType], *arguments: parameters.args, **keywordArguments: parameters.kwargs) -> None:
|
|
341
|
+
"""Execute generated tests for concurrency limit definitions.
|
|
342
|
+
|
|
343
|
+
(AI generated docstring)
|
|
344
|
+
|
|
345
|
+
Parameters
|
|
346
|
+
----------
|
|
347
|
+
nameOfTest : str
|
|
348
|
+
Name of the test case.
|
|
349
|
+
aPytest : Callable[..., Any]
|
|
350
|
+
The callable test function to execute.
|
|
351
|
+
*arguments : Any
|
|
352
|
+
Positional arguments for the test function.
|
|
353
|
+
**keywordArguments : Any
|
|
354
|
+
Keyword arguments for the test function.
|
|
355
|
+
|
|
356
|
+
"""
|
|
333
357
|
aPytest(*arguments, **keywordArguments)
|
|
334
358
|
|
|
335
359
|
@pytest.mark.parametrize("nameOfTest,aPytest", PytestFor_intInnit())
|
|
336
360
|
def testIntInnit(nameOfTest: str, aPytest: Callable[parameters, returnType], *arguments: parameters.args, **keywordArguments: parameters.kwargs) -> None:
|
|
361
|
+
"""Execute generated tests for integer initialization.
|
|
362
|
+
|
|
363
|
+
(AI generated docstring)
|
|
364
|
+
|
|
365
|
+
Parameters
|
|
366
|
+
----------
|
|
367
|
+
nameOfTest : str
|
|
368
|
+
Name of the test case.
|
|
369
|
+
aPytest : Callable[..., Any]
|
|
370
|
+
The callable test function to execute.
|
|
371
|
+
*arguments : Any
|
|
372
|
+
Positional arguments for the test function.
|
|
373
|
+
**keywordArguments : Any
|
|
374
|
+
Keyword arguments for the test function.
|
|
375
|
+
|
|
376
|
+
"""
|
|
337
377
|
aPytest(*arguments, **keywordArguments)
|
|
338
378
|
|
|
339
379
|
@pytest.mark.parametrize("nameOfTest,aPytest", PytestFor_oopsieKwargsie())
|
|
340
380
|
def testOopsieKwargsie(nameOfTest: str, aPytest: Callable[parameters, returnType], *arguments: parameters.args, **keywordArguments: parameters.kwargs) -> None:
|
|
381
|
+
"""Execute generated tests for boolean string parsing.
|
|
382
|
+
|
|
383
|
+
(AI generated docstring)
|
|
384
|
+
|
|
385
|
+
Parameters
|
|
386
|
+
----------
|
|
387
|
+
nameOfTest : str
|
|
388
|
+
Name of the test case.
|
|
389
|
+
aPytest : Callable[..., Any]
|
|
390
|
+
The callable test function to execute.
|
|
391
|
+
*arguments : Any
|
|
392
|
+
Positional arguments for the test function.
|
|
393
|
+
**keywordArguments : Any
|
|
394
|
+
Keyword arguments for the test function.
|
|
395
|
+
|
|
396
|
+
"""
|
|
341
397
|
aPytest(*arguments, **keywordArguments)
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
"""Tests for `Ordinals` ordering behaviors.
|
|
2
|
+
|
|
3
|
+
(AI generated docstring)
|
|
4
|
+
|
|
5
|
+
This module validates comparison semantics and sorting consistency across built-in and custom comparables using `pytest`.
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from hunterMakesPy.tests.conftest import uniformTestFailureMessage
|
|
13
|
+
from hunterMakesPy.theTypes import Ordinals
|
|
14
|
+
from typing import Self, TYPE_CHECKING, TypeVar
|
|
15
|
+
import inspect
|
|
16
|
+
import pytest
|
|
17
|
+
|
|
18
|
+
if TYPE_CHECKING:
|
|
19
|
+
from collections.abc import Callable
|
|
20
|
+
|
|
21
|
+
小于 = TypeVar('小于', bound=Ordinals)
|
|
22
|
+
"""Type variable bound to `Ordinals`.
|
|
23
|
+
|
|
24
|
+
(AI generated docstring)
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
def between(floor: 小于, ceiling: 小于, comparand: 小于) -> bool:
|
|
29
|
+
"""Return whether `comparand` lies between `floor` and `ceiling` inclusive.
|
|
30
|
+
|
|
31
|
+
Parameters
|
|
32
|
+
----------
|
|
33
|
+
floor : 小于
|
|
34
|
+
Lower bound for `comparand`.
|
|
35
|
+
ceiling : 小于
|
|
36
|
+
Upper bound for `comparand`.
|
|
37
|
+
comparand : 小于
|
|
38
|
+
Value compared against `floor` and `ceiling`.
|
|
39
|
+
|
|
40
|
+
Returns
|
|
41
|
+
-------
|
|
42
|
+
isBetween : bool
|
|
43
|
+
Whether `comparand` is within the inclusive bounds.
|
|
44
|
+
|
|
45
|
+
"""
|
|
46
|
+
return floor <= comparand <= ceiling
|
|
47
|
+
|
|
48
|
+
@dataclass(frozen=True, slots=True)
|
|
49
|
+
class ComparableCardinal:
|
|
50
|
+
"""Comparable wrapper for an `int` value.
|
|
51
|
+
|
|
52
|
+
(AI generated docstring)
|
|
53
|
+
|
|
54
|
+
Attributes
|
|
55
|
+
----------
|
|
56
|
+
value : int
|
|
57
|
+
Integer used for ordering comparisons.
|
|
58
|
+
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
value: int
|
|
62
|
+
"""Integer used for ordering comparisons.
|
|
63
|
+
|
|
64
|
+
(AI generated docstring)
|
|
65
|
+
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
def __le__(self: Self, other: Self, /) -> bool:
|
|
69
|
+
"""Return whether `self` is less than or equal to `other`.
|
|
70
|
+
|
|
71
|
+
(AI generated docstring)
|
|
72
|
+
|
|
73
|
+
Parameters
|
|
74
|
+
----------
|
|
75
|
+
self : Self
|
|
76
|
+
Instance compared against `other`.
|
|
77
|
+
other : Self
|
|
78
|
+
Instance compared against `self`.
|
|
79
|
+
|
|
80
|
+
Returns
|
|
81
|
+
-------
|
|
82
|
+
isLessThanOrEqual : bool
|
|
83
|
+
Whether `self` is ordered before or equal to `other`.
|
|
84
|
+
|
|
85
|
+
"""
|
|
86
|
+
return self.value <= other.value
|
|
87
|
+
|
|
88
|
+
def __lt__(self: Self, other: Self, /) -> bool:
|
|
89
|
+
"""Return whether `self` is strictly less than `other`.
|
|
90
|
+
|
|
91
|
+
(AI generated docstring)
|
|
92
|
+
|
|
93
|
+
Parameters
|
|
94
|
+
----------
|
|
95
|
+
self : Self
|
|
96
|
+
Instance compared against `other`.
|
|
97
|
+
other : Self
|
|
98
|
+
Instance compared against `self`.
|
|
99
|
+
|
|
100
|
+
Returns
|
|
101
|
+
-------
|
|
102
|
+
isLessThan : bool
|
|
103
|
+
Whether `self` is ordered before `other`.
|
|
104
|
+
|
|
105
|
+
"""
|
|
106
|
+
return self.value < other.value
|
|
107
|
+
|
|
108
|
+
@pytest.mark.parametrize(
|
|
109
|
+
'floor, ceiling, comparand, expected'
|
|
110
|
+
, [
|
|
111
|
+
(13, 34, 21, True)
|
|
112
|
+
, (13, 34, 8, False)
|
|
113
|
+
]
|
|
114
|
+
)
|
|
115
|
+
def testOrdinalsBetweenWorksForInt(floor: int, ceiling: int, comparand: int, expected: bool) -> None:
|
|
116
|
+
"""Verify `between` handles `int` operands.
|
|
117
|
+
|
|
118
|
+
(AI generated docstring)
|
|
119
|
+
|
|
120
|
+
Parameters
|
|
121
|
+
----------
|
|
122
|
+
floor : int
|
|
123
|
+
Lower bound for `comparand`.
|
|
124
|
+
ceiling : int
|
|
125
|
+
Upper bound for `comparand`.
|
|
126
|
+
comparand : int
|
|
127
|
+
Value of `comparand` compared against the bounds.
|
|
128
|
+
expected : bool
|
|
129
|
+
Expected outcome from `between`.
|
|
130
|
+
|
|
131
|
+
Returns
|
|
132
|
+
-------
|
|
133
|
+
unusedReturnValue : None
|
|
134
|
+
Returns `None`.
|
|
135
|
+
|
|
136
|
+
"""
|
|
137
|
+
actual: bool = between(floor, ceiling, comparand)
|
|
138
|
+
assert actual == expected, uniformTestFailureMessage(
|
|
139
|
+
expected
|
|
140
|
+
, actual
|
|
141
|
+
, 'between'
|
|
142
|
+
, floor
|
|
143
|
+
, ceiling
|
|
144
|
+
, comparand
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
@pytest.mark.parametrize(
|
|
148
|
+
'values, expected'
|
|
149
|
+
, [
|
|
150
|
+
([21, 13, 34, 8], [8, 13, 21, 34])
|
|
151
|
+
]
|
|
152
|
+
)
|
|
153
|
+
def testOrdinalsSortingWorksForInt(values: list[int], expected: list[int]) -> None:
|
|
154
|
+
"""Verify sorting uses ordinal ordering for `int` values.
|
|
155
|
+
|
|
156
|
+
(AI generated docstring)
|
|
157
|
+
|
|
158
|
+
Parameters
|
|
159
|
+
----------
|
|
160
|
+
values : list[int]
|
|
161
|
+
Input `values` to sort.
|
|
162
|
+
expected : list[int]
|
|
163
|
+
Expected sorted output for `values`.
|
|
164
|
+
|
|
165
|
+
Returns
|
|
166
|
+
-------
|
|
167
|
+
unusedReturnValue : None
|
|
168
|
+
Returns `None`.
|
|
169
|
+
|
|
170
|
+
"""
|
|
171
|
+
actual: list[int] = sorted(values)
|
|
172
|
+
assert actual == expected, uniformTestFailureMessage(
|
|
173
|
+
expected
|
|
174
|
+
, actual
|
|
175
|
+
, 'sorted'
|
|
176
|
+
, values
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
@pytest.mark.parametrize(
|
|
180
|
+
'floor, ceiling, comparand, expected'
|
|
181
|
+
, [
|
|
182
|
+
('fibonacci', 'prime', 'omega', True)
|
|
183
|
+
, ('fibonacci', 'prime', 'tango', False)
|
|
184
|
+
]
|
|
185
|
+
)
|
|
186
|
+
def testOrdinalsBetweenWorksForStr(floor: str, ceiling: str, comparand: str, expected: bool) -> None:
|
|
187
|
+
"""Verify `between` handles `str` operands.
|
|
188
|
+
|
|
189
|
+
(AI generated docstring)
|
|
190
|
+
|
|
191
|
+
Parameters
|
|
192
|
+
----------
|
|
193
|
+
floor : str
|
|
194
|
+
Lower bound for `comparand`.
|
|
195
|
+
ceiling : str
|
|
196
|
+
Upper bound for `comparand`.
|
|
197
|
+
comparand : str
|
|
198
|
+
Value of `comparand` compared against the bounds.
|
|
199
|
+
expected : bool
|
|
200
|
+
Expected outcome from `between`.
|
|
201
|
+
|
|
202
|
+
Returns
|
|
203
|
+
-------
|
|
204
|
+
unusedReturnValue : None
|
|
205
|
+
Returns `None`.
|
|
206
|
+
|
|
207
|
+
"""
|
|
208
|
+
actual: bool = between(floor, ceiling, comparand)
|
|
209
|
+
assert actual == expected, uniformTestFailureMessage(
|
|
210
|
+
expected
|
|
211
|
+
, actual
|
|
212
|
+
, 'between'
|
|
213
|
+
, floor
|
|
214
|
+
, ceiling
|
|
215
|
+
, comparand
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
@pytest.mark.parametrize(
|
|
219
|
+
'values, expected'
|
|
220
|
+
, [
|
|
221
|
+
(['prime', 'fibonacci', 'omega'], ['fibonacci', 'omega', 'prime'])
|
|
222
|
+
]
|
|
223
|
+
)
|
|
224
|
+
def testOrdinalsSortingWorksForStr(values: list[str], expected: list[str]) -> None:
|
|
225
|
+
"""Verify sorting uses ordinal ordering for `str` values.
|
|
226
|
+
|
|
227
|
+
(AI generated docstring)
|
|
228
|
+
|
|
229
|
+
Parameters
|
|
230
|
+
----------
|
|
231
|
+
values : list[str]
|
|
232
|
+
Input `values` to sort.
|
|
233
|
+
expected : list[str]
|
|
234
|
+
Expected sorted output for `values`.
|
|
235
|
+
|
|
236
|
+
Returns
|
|
237
|
+
-------
|
|
238
|
+
unusedReturnValue : None
|
|
239
|
+
Returns `None`.
|
|
240
|
+
|
|
241
|
+
"""
|
|
242
|
+
actual: list[str] = sorted(values)
|
|
243
|
+
assert actual == expected, uniformTestFailureMessage(
|
|
244
|
+
expected
|
|
245
|
+
, actual
|
|
246
|
+
, 'sorted'
|
|
247
|
+
, values
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
@pytest.mark.parametrize(
|
|
251
|
+
'floor, ceiling, comparand, expected'
|
|
252
|
+
, [
|
|
253
|
+
((13, 17), (21, 2), (13, 19), True)
|
|
254
|
+
, ((13, 17), (21, 2), (8, 34), False)
|
|
255
|
+
]
|
|
256
|
+
)
|
|
257
|
+
def testOrdinalsBetweenWorksForTuple(floor: tuple[int, int], ceiling: tuple[int, int], comparand: tuple[int, int], expected: bool) -> None:
|
|
258
|
+
"""Verify `between` handles `tuple[int, int]` operands.
|
|
259
|
+
|
|
260
|
+
(AI generated docstring)
|
|
261
|
+
|
|
262
|
+
Parameters
|
|
263
|
+
----------
|
|
264
|
+
floor : tuple[int, int]
|
|
265
|
+
Lower bound for `comparand`.
|
|
266
|
+
ceiling : tuple[int, int]
|
|
267
|
+
Upper bound for `comparand`.
|
|
268
|
+
comparand : tuple[int, int]
|
|
269
|
+
Value of `comparand` compared against the bounds.
|
|
270
|
+
expected : bool
|
|
271
|
+
Expected outcome from `between`.
|
|
272
|
+
|
|
273
|
+
Returns
|
|
274
|
+
-------
|
|
275
|
+
unusedReturnValue : None
|
|
276
|
+
Returns `None`.
|
|
277
|
+
|
|
278
|
+
"""
|
|
279
|
+
actual: bool = between(floor, ceiling, comparand)
|
|
280
|
+
assert actual == expected, uniformTestFailureMessage(
|
|
281
|
+
expected
|
|
282
|
+
, actual
|
|
283
|
+
, 'between'
|
|
284
|
+
, floor
|
|
285
|
+
, ceiling
|
|
286
|
+
, comparand
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
@pytest.mark.parametrize(
|
|
290
|
+
'values, expected'
|
|
291
|
+
, [
|
|
292
|
+
(
|
|
293
|
+
[(21, 2), (13, 19), (13, 17), (8, 34)]
|
|
294
|
+
, [(8, 34), (13, 17), (13, 19), (21, 2)]
|
|
295
|
+
),
|
|
296
|
+
],
|
|
297
|
+
)
|
|
298
|
+
def testOrdinalsSortingWorksForTuple(values: list[tuple[int, int]], expected: list[tuple[int, int]]) -> None:
|
|
299
|
+
"""Verify sorting uses ordinal ordering for `tuple[int, int]` values.
|
|
300
|
+
|
|
301
|
+
(AI generated docstring)
|
|
302
|
+
|
|
303
|
+
Parameters
|
|
304
|
+
----------
|
|
305
|
+
values : list[tuple[int, int]]
|
|
306
|
+
Input `values` to sort.
|
|
307
|
+
expected : list[tuple[int, int]]
|
|
308
|
+
Expected sorted output for `values`.
|
|
309
|
+
|
|
310
|
+
Returns
|
|
311
|
+
-------
|
|
312
|
+
unusedReturnValue : None
|
|
313
|
+
Returns `None`.
|
|
314
|
+
|
|
315
|
+
"""
|
|
316
|
+
actual: list[tuple[int, int]] = sorted(values)
|
|
317
|
+
assert actual == expected, uniformTestFailureMessage(
|
|
318
|
+
expected
|
|
319
|
+
, actual
|
|
320
|
+
, 'sorted'
|
|
321
|
+
, values
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
@pytest.mark.parametrize(
|
|
325
|
+
'floor, ceiling, comparand, expected'
|
|
326
|
+
, [
|
|
327
|
+
(ComparableCardinal(13), ComparableCardinal(34), ComparableCardinal(21), True)
|
|
328
|
+
, (ComparableCardinal(13), ComparableCardinal(34), ComparableCardinal(8), False)
|
|
329
|
+
]
|
|
330
|
+
)
|
|
331
|
+
def testOrdinalsBetweenWorksForCustomComparable(
|
|
332
|
+
floor: ComparableCardinal,
|
|
333
|
+
ceiling: ComparableCardinal,
|
|
334
|
+
comparand: ComparableCardinal,
|
|
335
|
+
expected: bool,
|
|
336
|
+
) -> None:
|
|
337
|
+
"""Verify `between` handles `ComparableCardinal` operands.
|
|
338
|
+
|
|
339
|
+
(AI generated docstring)
|
|
340
|
+
|
|
341
|
+
Parameters
|
|
342
|
+
----------
|
|
343
|
+
floor : ComparableCardinal
|
|
344
|
+
Lower `ComparableCardinal` bound for `comparand`.
|
|
345
|
+
ceiling : ComparableCardinal
|
|
346
|
+
Upper `ComparableCardinal` bound for `comparand`.
|
|
347
|
+
comparand : ComparableCardinal
|
|
348
|
+
Value of `comparand` compared against the bounds.
|
|
349
|
+
expected : bool
|
|
350
|
+
Expected outcome from `between`.
|
|
351
|
+
|
|
352
|
+
Returns
|
|
353
|
+
-------
|
|
354
|
+
unusedReturnValue : None
|
|
355
|
+
Returns `None`.
|
|
356
|
+
|
|
357
|
+
"""
|
|
358
|
+
actual: bool = between(floor, ceiling, comparand)
|
|
359
|
+
assert actual == expected, uniformTestFailureMessage(
|
|
360
|
+
expected
|
|
361
|
+
, actual
|
|
362
|
+
, 'between'
|
|
363
|
+
, floor
|
|
364
|
+
, ceiling
|
|
365
|
+
, comparand
|
|
366
|
+
)
|
|
367
|
+
|
|
368
|
+
@pytest.mark.parametrize(
|
|
369
|
+
'comparisonMethodName'
|
|
370
|
+
, [
|
|
371
|
+
'__le__'
|
|
372
|
+
, '__lt__'
|
|
373
|
+
]
|
|
374
|
+
)
|
|
375
|
+
def testOrdinalsComparisonMethodsAcceptOtherOperand(comparisonMethodName: str) -> None:
|
|
376
|
+
"""Validate `Ordinals` comparison method signatures.
|
|
377
|
+
|
|
378
|
+
(AI generated docstring)
|
|
379
|
+
|
|
380
|
+
Parameters
|
|
381
|
+
----------
|
|
382
|
+
comparisonMethodName : str
|
|
383
|
+
Name of the `Ordinals` comparison method to inspect.
|
|
384
|
+
|
|
385
|
+
Returns
|
|
386
|
+
-------
|
|
387
|
+
unusedReturnValue : None
|
|
388
|
+
Returns `None`.
|
|
389
|
+
|
|
390
|
+
"""
|
|
391
|
+
comparisonMethod: Callable[[Ordinals, Ordinals], bool] = getattr(Ordinals, comparisonMethodName)
|
|
392
|
+
signature: inspect.Signature = inspect.signature(comparisonMethod)
|
|
393
|
+
listParameters: list[inspect.Parameter] = list(signature.parameters.values())
|
|
394
|
+
|
|
395
|
+
assert len(listParameters) == 2, uniformTestFailureMessage(
|
|
396
|
+
2
|
|
397
|
+
, len(listParameters)
|
|
398
|
+
, 'Ordinals comparison parameter count'
|
|
399
|
+
, comparisonMethodName
|
|
400
|
+
, signature
|
|
401
|
+
)
|
|
402
|
+
|
|
403
|
+
listKinds: list[inspect._ParameterKind] = [parameter.kind for parameter in listParameters]
|
|
404
|
+
expectedKinds: list[inspect._ParameterKind] = [inspect.Parameter.POSITIONAL_ONLY, inspect.Parameter.POSITIONAL_ONLY]
|
|
405
|
+
assert listKinds == expectedKinds, uniformTestFailureMessage(
|
|
406
|
+
expectedKinds
|
|
407
|
+
, listKinds
|
|
408
|
+
, 'Ordinals comparison parameter kinds'
|
|
409
|
+
, comparisonMethodName
|
|
410
|
+
, signature
|
|
411
|
+
)
|
|
412
|
+
|
|
413
|
+
actualReturnAnnotation: object = signature.return_annotation
|
|
414
|
+
assert actualReturnAnnotation is bool, uniformTestFailureMessage(
|
|
415
|
+
bool
|
|
416
|
+
, actualReturnAnnotation
|
|
417
|
+
, 'Ordinals comparison return annotation'
|
|
418
|
+
, comparisonMethodName
|
|
419
|
+
, signature
|
|
420
|
+
)
|
hunterMakesPy/theTypes.py
CHANGED
|
@@ -5,17 +5,15 @@ identifierDotAttribute: TypeAlias = str
|
|
|
5
5
|
"""`str` (***str***ing) representing a dotted attribute identifier.
|
|
6
6
|
|
|
7
7
|
`TypeAlias` for a `str` `object` using dot notation to access an attribute, such as 'scipy.signal.windows'.
|
|
8
|
-
|
|
9
8
|
"""
|
|
10
9
|
|
|
11
10
|
class Ordinals(Protocol):
|
|
12
11
|
"""Any Python `object` `type` that may be ordered before or after a comparable `object` `type` by comparison operators."""
|
|
13
12
|
|
|
14
|
-
def __le__(self, not_self_selfButSelfSelf_youKnow: Self, /) -> bool:
|
|
13
|
+
def __le__(self: Self, not_self_selfButSelfSelf_youKnow: Self, /) -> bool:
|
|
15
14
|
"""Comparison by "***l***ess than or ***e***qual to"."""
|
|
16
15
|
...
|
|
17
16
|
|
|
18
|
-
def __lt__(self,
|
|
17
|
+
def __lt__(self: Self, otherSelfWhichIsNotAnOxymoron: Self, /) -> bool:
|
|
19
18
|
"""Comparison by "***l***ess ***t***han"."""
|
|
20
19
|
...
|
|
21
|
-
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
hunterMakesPy/__init__.py,sha256=bydhevjZG6_JT2q_v9rfozvjhXVqyyUGCovL6EwxlBk,1168
|
|
2
|
+
hunterMakesPy/_theSSOT.py,sha256=x9Rdmw0qeAqgmlMFyFYRTRV5kEDYXcN4aBZ4KjlnKEU,170
|
|
3
|
+
hunterMakesPy/coping.py,sha256=42a_1kB6zHeRpfbpPnjmhrgWTPvUtqE5W9z3tqu-K8w,6068
|
|
4
|
+
hunterMakesPy/dataStructures.py,sha256=GbFk5uJskkjL5WNCSJbgn7BKQVh0f792gZ4zgSod9H8,11934
|
|
5
|
+
hunterMakesPy/filesystemToolkit.py,sha256=4zgXrDELBnS2UJ4sGPJVFyyrjDwfF0evnGIWssm--Jk,6809
|
|
6
|
+
hunterMakesPy/parseParameters.py,sha256=k5sGBoCeVRK02lNze59xPb99UiXm2l-HXI5HQPcKHnY,11321
|
|
7
|
+
hunterMakesPy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
hunterMakesPy/pytestForYourUse.py,sha256=wQe9e4ndiVpQQjm_VJFbo1WSRkmiF4Hx3RkCmw5jhcU,413
|
|
9
|
+
hunterMakesPy/theTypes.py,sha256=uj5p0S2amTY-hhTIyQwDdvsLETiqTi8nI4-lScNtc38,741
|
|
10
|
+
hunterMakesPy/tests/__init__.py,sha256=C_FzfKDi_VrGVxlenWHyOYtKShAKlt3KW14jeRx1mQI,224
|
|
11
|
+
hunterMakesPy/tests/conftest.py,sha256=yX8RCaAnV7cDPk7G0EQsdCUhN3lWtcUzwe-EUjCdWsE,5108
|
|
12
|
+
hunterMakesPy/tests/test_coping.py,sha256=2PE2CRqAvIAWAMCX_lkkRLjH9IXPtMDWOWIDQschcJ0,11412
|
|
13
|
+
hunterMakesPy/tests/test_dataStructures.py,sha256=btLgXK5ksUntYToDFreXv0BMgr9XzH0aP0hgpPsPMBU,19310
|
|
14
|
+
hunterMakesPy/tests/test_filesystemToolkit.py,sha256=obKbiruo8Vpwx7R-5cTQMJHxsQuXQrHRkWIEYOPcy_E,19491
|
|
15
|
+
hunterMakesPy/tests/test_parseParameters.py,sha256=lRsAsAmIoNoSei0xlwek7Uu9ypaWiDFTYe4UnFG9MqU,14585
|
|
16
|
+
hunterMakesPy/tests/test_theTypes.py,sha256=efd1i-43Bz1oZRJQJf2H8mWpFbCfYcuqjVWH3VrVqTE,9253
|
|
17
|
+
huntermakespy-0.3.4.dist-info/licenses/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
|
|
18
|
+
huntermakespy-0.3.4.dist-info/METADATA,sha256=ZPiwKZBsBYXXif2DggcOT0COaO646sUioEgmprbjiA4,6319
|
|
19
|
+
huntermakespy-0.3.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
20
|
+
huntermakespy-0.3.4.dist-info/top_level.txt,sha256=Uh4bj8EDTdsRpqY1VlK_his_B4HDfZ6Tqrwhoj75P_w,14
|
|
21
|
+
huntermakespy-0.3.4.dist-info/RECORD,,
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
hunterMakesPy/__init__.py,sha256=bydhevjZG6_JT2q_v9rfozvjhXVqyyUGCovL6EwxlBk,1168
|
|
2
|
-
hunterMakesPy/_theSSOT.py,sha256=x9Rdmw0qeAqgmlMFyFYRTRV5kEDYXcN4aBZ4KjlnKEU,170
|
|
3
|
-
hunterMakesPy/coping.py,sha256=42a_1kB6zHeRpfbpPnjmhrgWTPvUtqE5W9z3tqu-K8w,6068
|
|
4
|
-
hunterMakesPy/dataStructures.py,sha256=GbFk5uJskkjL5WNCSJbgn7BKQVh0f792gZ4zgSod9H8,11934
|
|
5
|
-
hunterMakesPy/filesystemToolkit.py,sha256=4zgXrDELBnS2UJ4sGPJVFyyrjDwfF0evnGIWssm--Jk,6809
|
|
6
|
-
hunterMakesPy/parseParameters.py,sha256=k5sGBoCeVRK02lNze59xPb99UiXm2l-HXI5HQPcKHnY,11321
|
|
7
|
-
hunterMakesPy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
hunterMakesPy/pytestForYourUse.py,sha256=GiN1C1gTTM0ZunRPEMnrKlLQLMdH0wF_ZGr_RPgRjjA,500
|
|
9
|
-
hunterMakesPy/theTypes.py,sha256=Ce2hGCsBgd_DaUVoWZ6Iq-Lp4qf6053orHq0o52ssgM,734
|
|
10
|
-
hunterMakesPy/tests/__init__.py,sha256=C_FzfKDi_VrGVxlenWHyOYtKShAKlt3KW14jeRx1mQI,224
|
|
11
|
-
hunterMakesPy/tests/conftest.py,sha256=NZQPRiwvGhP16hJ6WGGm9eKLxfQArYV8E9X12YzSpP0,2827
|
|
12
|
-
hunterMakesPy/tests/test_coping.py,sha256=mH89TUAL6fJanBLlhdVlCNNQqm5OpdcQMP_p5W2JJwo,9860
|
|
13
|
-
hunterMakesPy/tests/test_dataStructures.py,sha256=WQlq98SllAPSUEjvIHZ9Az2pKNWeLNP4dnl3UyP9yuc,16004
|
|
14
|
-
hunterMakesPy/tests/test_filesystemToolkit.py,sha256=_CoSMzstJwWZ_tkNyIqclOIIqTaY2tYfUIgxGFfC0Jk,15335
|
|
15
|
-
hunterMakesPy/tests/test_parseParameters.py,sha256=UKf1hwhLtXYL96VVJNf8NpJOyzRLO204pd-9PdDjufA,13267
|
|
16
|
-
huntermakespy-0.3.3.dist-info/licenses/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
|
|
17
|
-
huntermakespy-0.3.3.dist-info/METADATA,sha256=VNrznpDWhCCoxUM0nAufsjImFAiVagnHgFbCPPXxnzQ,6319
|
|
18
|
-
huntermakespy-0.3.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
19
|
-
huntermakespy-0.3.3.dist-info/top_level.txt,sha256=Uh4bj8EDTdsRpqY1VlK_his_B4HDfZ6Tqrwhoj75P_w,14
|
|
20
|
-
huntermakespy-0.3.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|