mapFolding 0.4.3__py3-none-any.whl → 0.5.0__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.
- mapFolding/__init__.py +1 -1
- mapFolding/basecamp.py +11 -13
- mapFolding/beDRY.py +21 -20
- mapFolding/oeis.py +21 -20
- mapFolding/someAssemblyRequired/makeJob.py +8 -7
- mapFolding/someAssemblyRequired/synthesizeModuleJAX.py +1 -3
- mapFolding/someAssemblyRequired/synthesizeNumba.py +19 -14
- mapFolding/someAssemblyRequired/synthesizeNumbaGeneralized.py +22 -21
- mapFolding/someAssemblyRequired/synthesizeNumbaJob.py +6 -13
- mapFolding/someAssemblyRequired/synthesizeNumbaModules.py +9 -15
- mapFolding/syntheticModules/numbaCount.py +6 -6
- mapFolding/syntheticModules/numba_doTheNeedful.py +4 -4
- mapFolding/theDao.py +48 -48
- mapFolding/theSSOT.py +35 -21
- mapFolding/theSSOTdatatypes.py +13 -15
- {mapFolding-0.4.3.dist-info → mapFolding-0.5.0.dist-info}/METADATA +2 -1
- mapFolding-0.5.0.dist-info/RECORD +39 -0
- tests/conftest.py +56 -27
- tests/test_computations.py +5 -6
- tests/test_oeis.py +1 -2
- tests/test_other.py +11 -7
- tests/test_tasks.py +5 -5
- mapFolding-0.4.3.dist-info/RECORD +0 -40
- tests/test_types.py +0 -5
- {mapFolding-0.4.3.dist-info → mapFolding-0.5.0.dist-info}/LICENSE +0 -0
- {mapFolding-0.4.3.dist-info → mapFolding-0.5.0.dist-info}/WHEEL +0 -0
- {mapFolding-0.4.3.dist-info → mapFolding-0.5.0.dist-info}/entry_points.txt +0 -0
- {mapFolding-0.4.3.dist-info → mapFolding-0.5.0.dist-info}/top_level.txt +0 -0
tests/conftest.py
CHANGED
|
@@ -2,16 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
# TODO learn how to run tests and coverage analysis without `env = ["NUMBA_DISABLE_JIT=1"]`
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
from mapFolding import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
from collections.abc import Callable, Generator, Sequence
|
|
6
|
+
from mapFolding import (
|
|
7
|
+
getAlgorithmDispatcher,
|
|
8
|
+
getDispatcherCallable,
|
|
9
|
+
countFolds,
|
|
10
|
+
getPathFilenameFoldsTotal,
|
|
11
|
+
oeisIDfor_n,
|
|
12
|
+
saveFoldsTotal,
|
|
13
|
+
hackSSOTdtype,
|
|
14
|
+
clearOEIScache,
|
|
15
|
+
getOEISids,
|
|
16
|
+
)
|
|
17
|
+
from mapFolding import basecamp
|
|
18
|
+
from mapFolding.beDRY import (
|
|
19
|
+
getLeavesTotal,
|
|
20
|
+
validateListDimensions,
|
|
21
|
+
makeDataContainer,
|
|
22
|
+
parseDimensions,
|
|
23
|
+
setCPUlimit,
|
|
24
|
+
makeConnectionGraph,
|
|
25
|
+
getTaskDivisions,
|
|
26
|
+
)
|
|
27
|
+
from mapFolding.oeis import (
|
|
28
|
+
oeisIDsImplemented,
|
|
29
|
+
settingsOEIS,
|
|
30
|
+
validateOEISid,
|
|
31
|
+
getOEISidValues,
|
|
32
|
+
OEIS_for_n,
|
|
33
|
+
)
|
|
34
|
+
from mapFolding.someAssemblyRequired import (
|
|
35
|
+
makeFlowNumbaOptimized,
|
|
36
|
+
youOughtaKnow,
|
|
37
|
+
writeJobNumba,
|
|
38
|
+
)
|
|
39
|
+
from pathlib import Path
|
|
10
40
|
from types import ModuleType
|
|
11
|
-
from typing import Any,
|
|
41
|
+
from typing import Any, ContextManager, Literal, NoReturn, Final
|
|
12
42
|
from Z0Z_tools.pytestForYourUse import PytestFor_defineConcurrencyLimit, PytestFor_intInnit, PytestFor_oopsieKwargsie
|
|
13
43
|
import importlib.util
|
|
14
|
-
import pathlib
|
|
15
44
|
import pytest
|
|
16
45
|
import random
|
|
17
46
|
import shutil
|
|
@@ -19,14 +48,14 @@ import unittest.mock
|
|
|
19
48
|
import uuid
|
|
20
49
|
|
|
21
50
|
# SSOT for test data paths and filenames
|
|
22
|
-
pathDataSamples =
|
|
51
|
+
pathDataSamples = Path("tests/dataSamples")
|
|
23
52
|
# NOTE `tmp` is not a diminutive form of temporary: it signals a technical term. And "temp" is strongly disfavored.
|
|
24
|
-
pathTmpRoot = pathDataSamples / "tmp"
|
|
53
|
+
pathTmpRoot: Path = pathDataSamples / "tmp"
|
|
25
54
|
|
|
26
55
|
# The registrar maintains the register of temp files
|
|
27
|
-
registerOfTemporaryFilesystemObjects:
|
|
56
|
+
registerOfTemporaryFilesystemObjects: set[Path] = set()
|
|
28
57
|
|
|
29
|
-
def registrarRecordsTmpObject(path:
|
|
58
|
+
def registrarRecordsTmpObject(path: Path) -> None:
|
|
30
59
|
"""The registrar adds a tmp file to the register."""
|
|
31
60
|
registerOfTemporaryFilesystemObjects.add(path)
|
|
32
61
|
|
|
@@ -51,7 +80,7 @@ def setupTeardownTmpObjects() -> Generator[None, None, None]:
|
|
|
51
80
|
registrarDeletesTmpObjects()
|
|
52
81
|
|
|
53
82
|
@pytest.fixture
|
|
54
|
-
def pathTmpTesting(request: pytest.FixtureRequest) ->
|
|
83
|
+
def pathTmpTesting(request: pytest.FixtureRequest) -> Path:
|
|
55
84
|
# "Z0Z_" ensures the directory name does not start with a number, which would make it an invalid Python identifier
|
|
56
85
|
pathTmp = pathTmpRoot / ("Z0Z_" + str(uuid.uuid4().hex))
|
|
57
86
|
pathTmp.mkdir(parents=True, exist_ok=False)
|
|
@@ -60,7 +89,7 @@ def pathTmpTesting(request: pytest.FixtureRequest) -> pathlib.Path:
|
|
|
60
89
|
return pathTmp
|
|
61
90
|
|
|
62
91
|
@pytest.fixture
|
|
63
|
-
def pathFilenameTmpTesting(request: pytest.FixtureRequest) ->
|
|
92
|
+
def pathFilenameTmpTesting(request: pytest.FixtureRequest) -> Path:
|
|
64
93
|
try:
|
|
65
94
|
extension = request.param
|
|
66
95
|
except AttributeError:
|
|
@@ -71,14 +100,14 @@ def pathFilenameTmpTesting(request: pytest.FixtureRequest) -> pathlib.Path:
|
|
|
71
100
|
subpath = "Z0Z_" + uuidHex[0:-8]
|
|
72
101
|
filenameStem = "Z0Z_" + uuidHex[-8:None]
|
|
73
102
|
|
|
74
|
-
pathFilenameTmp =
|
|
103
|
+
pathFilenameTmp = Path(pathTmpRoot, subpath, filenameStem + extension)
|
|
75
104
|
pathFilenameTmp.parent.mkdir(parents=True, exist_ok=False)
|
|
76
105
|
|
|
77
106
|
registrarRecordsTmpObject(pathFilenameTmp)
|
|
78
107
|
return pathFilenameTmp
|
|
79
108
|
|
|
80
109
|
@pytest.fixture
|
|
81
|
-
def pathCacheTesting(pathTmpTesting:
|
|
110
|
+
def pathCacheTesting(pathTmpTesting: Path) -> Generator[Path, Any, None]:
|
|
82
111
|
"""Temporarily replace the OEIS cache directory with a test directory."""
|
|
83
112
|
from mapFolding import oeis as there_must_be_a_better_way
|
|
84
113
|
pathCacheOriginal = there_must_be_a_better_way._pathCache
|
|
@@ -87,12 +116,12 @@ def pathCacheTesting(pathTmpTesting: pathlib.Path) -> Generator[pathlib.Path, An
|
|
|
87
116
|
there_must_be_a_better_way._pathCache = pathCacheOriginal
|
|
88
117
|
|
|
89
118
|
@pytest.fixture
|
|
90
|
-
def pathFilenameFoldsTotalTesting(pathTmpTesting:
|
|
119
|
+
def pathFilenameFoldsTotalTesting(pathTmpTesting: Path) -> Path:
|
|
91
120
|
return pathTmpTesting.joinpath("foldsTotalTest.txt")
|
|
92
121
|
|
|
93
|
-
def makeDictionaryFoldsTotalKnown() ->
|
|
122
|
+
def makeDictionaryFoldsTotalKnown() -> dict[tuple[int, ...], int]:
|
|
94
123
|
"""Returns a dictionary mapping dimension tuples to their known folding totals."""
|
|
95
|
-
dictionaryMapDimensionsToFoldsTotalKnown:
|
|
124
|
+
dictionaryMapDimensionsToFoldsTotalKnown: dict[tuple[int, ...], int] = {}
|
|
96
125
|
|
|
97
126
|
for settings in settingsOEIS.values():
|
|
98
127
|
sequence = settings['valuesKnown']
|
|
@@ -115,7 +144,7 @@ def setupWarningsAsErrors() -> Generator[None, Any, None]:
|
|
|
115
144
|
warnings.resetwarnings()
|
|
116
145
|
|
|
117
146
|
@pytest.fixture
|
|
118
|
-
def foldsTotalKnown() ->
|
|
147
|
+
def foldsTotalKnown() -> dict[tuple[int, ...], int]:
|
|
119
148
|
"""Returns a dictionary mapping dimension tuples to their known folding totals.
|
|
120
149
|
NOTE I am not convinced this is the best way to do this.
|
|
121
150
|
Advantage: I call `makeDictionaryFoldsTotalKnown()` from modules other than test modules.
|
|
@@ -124,7 +153,7 @@ def foldsTotalKnown() -> Dict[Tuple[int,...], int]:
|
|
|
124
153
|
return makeDictionaryFoldsTotalKnown()
|
|
125
154
|
|
|
126
155
|
@pytest.fixture
|
|
127
|
-
def listDimensionsTestCountFolds(oeisID: str) ->
|
|
156
|
+
def listDimensionsTestCountFolds(oeisID: str) -> list[int]:
|
|
128
157
|
"""For each `oeisID` from the `pytest.fixture`, returns `listDimensions` from `valuesTestValidation`
|
|
129
158
|
if `validateListDimensions` approves. Each `listDimensions` is suitable for testing counts."""
|
|
130
159
|
while True:
|
|
@@ -139,7 +168,7 @@ def listDimensionsTestCountFolds(oeisID: str) -> List[int]:
|
|
|
139
168
|
pass
|
|
140
169
|
|
|
141
170
|
@pytest.fixture
|
|
142
|
-
def listDimensionsTestFunctionality(oeisID_1random: str) ->
|
|
171
|
+
def listDimensionsTestFunctionality(oeisID_1random: str) -> list[int]:
|
|
143
172
|
"""To test functionality, get one `listDimensions` from `valuesTestValidation` if
|
|
144
173
|
`validateListDimensions` approves. The algorithm can count the folds of the returned
|
|
145
174
|
`listDimensions` in a short enough time suitable for testing."""
|
|
@@ -155,7 +184,7 @@ def listDimensionsTestFunctionality(oeisID_1random: str) -> List[int]:
|
|
|
155
184
|
pass
|
|
156
185
|
|
|
157
186
|
@pytest.fixture
|
|
158
|
-
def listDimensionsTestParallelization(oeisID: str) ->
|
|
187
|
+
def listDimensionsTestParallelization(oeisID: str) -> list[int]:
|
|
159
188
|
"""For each `oeisID` from the `pytest.fixture`, returns `listDimensions` from `valuesTestParallelization`"""
|
|
160
189
|
n = random.choice(settingsOEIS[oeisID]['valuesTestParallelization'])
|
|
161
190
|
return settingsOEIS[oeisID]['getMapShape'](n)
|
|
@@ -170,7 +199,7 @@ def mockBenchmarkTimer() -> Generator[unittest.mock.MagicMock | unittest.mock.As
|
|
|
170
199
|
@pytest.fixture
|
|
171
200
|
def mockFoldingFunction() -> Callable[..., Callable[..., None]]:
|
|
172
201
|
"""Creates a mock function that simulates _countFolds behavior."""
|
|
173
|
-
def make_mock(foldsValue: int, listDimensions:
|
|
202
|
+
def make_mock(foldsValue: int, listDimensions: list[int]) -> Callable[..., None]:
|
|
174
203
|
mock_array = makeDataContainer(2)
|
|
175
204
|
mock_array[0] = foldsValue
|
|
176
205
|
mock_array[-1] = getLeavesTotal(listDimensions)
|
|
@@ -227,14 +256,14 @@ def useAlgorithmSourceDispatcher(useThisDispatcher: Callable) -> Generator[None,
|
|
|
227
256
|
|
|
228
257
|
@pytest.fixture
|
|
229
258
|
def syntheticDispatcherFixture(useThisDispatcher):
|
|
230
|
-
listCallablesInlineHARDCODED:
|
|
259
|
+
listCallablesInlineHARDCODED: list[str] = ['countInitialize', 'countParallel', 'countSequential']
|
|
231
260
|
listCallablesInline = listCallablesInlineHARDCODED
|
|
232
261
|
callableDispatcher = True
|
|
233
262
|
algorithmSource = None
|
|
234
263
|
relativePathWrite = None
|
|
235
264
|
filenameModuleWrite = 'pytestCount.py'
|
|
236
265
|
formatFilenameWrite = "pytest_{callableTarget}.py"
|
|
237
|
-
listSynthesizedModules:
|
|
266
|
+
listSynthesizedModules: list[youOughtaKnow] = makeFlowNumbaOptimized(listCallablesInline, callableDispatcher, algorithmSource, relativePathWrite, filenameModuleWrite, formatFilenameWrite)
|
|
238
267
|
dispatcherSynthetic = youOughtaKnow('','','')
|
|
239
268
|
for stuff in listSynthesizedModules:
|
|
240
269
|
registrarRecordsTmpObject(stuff.pathFilenameForMe)
|
|
@@ -262,7 +291,7 @@ def uniformTestMessage(expected: Any, actual: Any, functionName: str, *arguments
|
|
|
262
291
|
|
|
263
292
|
def standardizedEqualTo(expected: Any, functionTarget: Callable, *arguments: Any) -> None:
|
|
264
293
|
"""Template for tests expecting an error."""
|
|
265
|
-
if type(expected) is
|
|
294
|
+
if type(expected) is type[Exception]:
|
|
266
295
|
messageExpected = expected.__name__
|
|
267
296
|
else:
|
|
268
297
|
messageExpected = expected
|
|
@@ -275,7 +304,7 @@ def standardizedEqualTo(expected: Any, functionTarget: Callable, *arguments: Any
|
|
|
275
304
|
|
|
276
305
|
assert actual == expected, uniformTestMessage(messageExpected, messageActual, functionTarget.__name__, *arguments)
|
|
277
306
|
|
|
278
|
-
def standardizedSystemExit(expected:
|
|
307
|
+
def standardizedSystemExit(expected: str | int | Sequence[int], functionTarget: Callable, *arguments: Any) -> None:
|
|
279
308
|
"""Template for tests expecting SystemExit.
|
|
280
309
|
|
|
281
310
|
Parameters
|
tests/test_computations.py
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
1
|
from tests.conftest import *
|
|
3
2
|
import importlib.util
|
|
4
3
|
import pytest
|
|
5
4
|
|
|
6
|
-
def test_algorithmSourceParallel(listDimensionsTestParallelization:
|
|
5
|
+
def test_algorithmSourceParallel(listDimensionsTestParallelization: list[int], foldsTotalKnown: dict[tuple[int, ...], int], useAlgorithmSourceDispatcher: None) -> None:
|
|
7
6
|
standardizedEqualTo(foldsTotalKnown[tuple(listDimensionsTestParallelization)], countFolds, listDimensionsTestParallelization, None, 'maximum')
|
|
8
7
|
|
|
9
|
-
def test_algorithmSourceSequential(listDimensionsTestCountFolds:
|
|
8
|
+
def test_algorithmSourceSequential(listDimensionsTestCountFolds: list[int], foldsTotalKnown: dict[tuple[int, ...], int], useAlgorithmSourceDispatcher: None) -> None:
|
|
10
9
|
standardizedEqualTo(foldsTotalKnown[tuple(listDimensionsTestCountFolds)], countFolds, listDimensionsTestCountFolds)
|
|
11
10
|
|
|
12
11
|
def test_aOFn_calculate_value(oeisID: str) -> None:
|
|
@@ -14,7 +13,7 @@ def test_aOFn_calculate_value(oeisID: str) -> None:
|
|
|
14
13
|
standardizedEqualTo(settingsOEIS[oeisID]['valuesKnown'][n], oeisIDfor_n, oeisID, n)
|
|
15
14
|
|
|
16
15
|
@pytest.mark.parametrize('pathFilenameTmpTesting', ['.py'], indirect=True)
|
|
17
|
-
def test_writeJobNumba(listDimensionsTestCountFolds:
|
|
16
|
+
def test_writeJobNumba(listDimensionsTestCountFolds: list[int], foldsTotalKnown: dict[tuple[int, ...], int], pathFilenameTmpTesting: Path) -> None:
|
|
18
17
|
from mapFolding.syntheticModules import numbaCount
|
|
19
18
|
algorithmSourceHARDCODED: ModuleType = numbaCount
|
|
20
19
|
algorithmSource = algorithmSourceHARDCODED
|
|
@@ -36,8 +35,8 @@ def test_writeJobNumba(listDimensionsTestCountFolds: List[int], foldsTotalKnown:
|
|
|
36
35
|
registrarRecordsTmpObject(pathFilenameFoldsTotal)
|
|
37
36
|
standardizedEqualTo(str(foldsTotalKnown[tuple(listDimensionsTestCountFolds)]), pathFilenameFoldsTotal.read_text().strip)
|
|
38
37
|
|
|
39
|
-
def test_syntheticParallel(syntheticDispatcherFixture, listDimensionsTestParallelization:
|
|
38
|
+
def test_syntheticParallel(syntheticDispatcherFixture, listDimensionsTestParallelization: list[int], foldsTotalKnown: dict[tuple[int, ...], int]):
|
|
40
39
|
standardizedEqualTo(foldsTotalKnown[tuple(listDimensionsTestParallelization)], countFolds, listDimensionsTestParallelization, None, 'maximum')
|
|
41
40
|
|
|
42
|
-
def test_syntheticSequential(syntheticDispatcherFixture, listDimensionsTestCountFolds:
|
|
41
|
+
def test_syntheticSequential(syntheticDispatcherFixture, listDimensionsTestCountFolds: list[int], foldsTotalKnown: dict[tuple[int, ...], int]):
|
|
43
42
|
standardizedEqualTo(foldsTotalKnown[tuple(listDimensionsTestCountFolds)], countFolds, listDimensionsTestCountFolds)
|
tests/test_oeis.py
CHANGED
|
@@ -27,7 +27,6 @@ def test__validateOEISid_valid_id_case_insensitive(oeisID: str) -> None:
|
|
|
27
27
|
standardizedEqualTo(oeisID.upper(), validateOEISid, oeisID.swapcase())
|
|
28
28
|
|
|
29
29
|
parameters_test_aOFn_invalid_n = [
|
|
30
|
-
# (2, "ok"), # test the test template
|
|
31
30
|
(-random.randint(1, 100), "randomNegative"),
|
|
32
31
|
("foo", "string"),
|
|
33
32
|
(1.5, "float")
|
|
@@ -59,7 +58,7 @@ def test_clearOEIScache(mock_unlink: unittest.mock.MagicMock, mock_exists: unitt
|
|
|
59
58
|
mock_exists.assert_called_once()
|
|
60
59
|
mock_unlink.assert_not_called()
|
|
61
60
|
|
|
62
|
-
def testNetworkError(monkeypatch: pytest.MonkeyPatch, pathCacheTesting:
|
|
61
|
+
def testNetworkError(monkeypatch: pytest.MonkeyPatch, pathCacheTesting: Path) -> None:
|
|
63
62
|
"""Test network error handling."""
|
|
64
63
|
def mockUrlopen(*args: Any, **kwargs: Any) -> NoReturn:
|
|
65
64
|
raise URLError("Network error")
|
tests/test_other.py
CHANGED
|
@@ -43,7 +43,11 @@ import sys
|
|
|
43
43
|
(range(3, 7), [3, 4, 5, 6], [3, 4, 5, 6], [3, 4, 5, 6], 360), # range sequence type
|
|
44
44
|
(tuple([3, 5, 7]), [3, 5, 7], [3, 5, 7], [3, 5, 7], 105), # tuple sequence type
|
|
45
45
|
])
|
|
46
|
-
def test_listDimensionsAsParameter(listDimensions: None |
|
|
46
|
+
def test_listDimensionsAsParameter(listDimensions: None | list[str] | list[int] | list[float] | list[None] | list[bool] | list[list[int]] | list[complex] | range | tuple[int, ...],
|
|
47
|
+
expected_intInnit: type[ValueError] | list[int] | type[TypeError],
|
|
48
|
+
expected_parseListDimensions: type[ValueError] | list[int] | type[TypeError],
|
|
49
|
+
expected_validateListDimensions: type[ValueError] | type[NotImplementedError] | list[int] | type[TypeError],
|
|
50
|
+
expected_getLeavesTotal: type[ValueError] | int | type[TypeError] | type[OverflowError]) -> None:
|
|
47
51
|
"""Test both validateListDimensions and getLeavesTotal with the same inputs."""
|
|
48
52
|
standardizedEqualTo(expected_intInnit, intInnit, listDimensions)
|
|
49
53
|
standardizedEqualTo(expected_parseListDimensions, parseDimensions, listDimensions)
|
|
@@ -82,14 +86,14 @@ def testOopsieKwargsie(nameOfTest: str, callablePytest: Callable[[], None]) -> N
|
|
|
82
86
|
def test_setCPUlimit(CPUlimit: None | float | bool | Literal[4] | Literal[-2] | Literal[0] | Literal[1], expectedLimit: Any | int) -> None:
|
|
83
87
|
standardizedEqualTo(expectedLimit, setCPUlimit, CPUlimit)
|
|
84
88
|
|
|
85
|
-
def test_makeConnectionGraph_nonNegative(listDimensionsTestFunctionality:
|
|
89
|
+
def test_makeConnectionGraph_nonNegative(listDimensionsTestFunctionality: list[int]) -> None:
|
|
86
90
|
connectionGraph = makeConnectionGraph(listDimensionsTestFunctionality)
|
|
87
91
|
assert numpy.all(connectionGraph >= 0), "All values in the connection graph should be non-negative."
|
|
88
92
|
|
|
89
93
|
@pytest.fixture
|
|
90
|
-
def parameterIterator() -> Callable[[
|
|
94
|
+
def parameterIterator() -> Callable[[list[int]], Generator[dict[str, Any], None, None]]:
|
|
91
95
|
"""Generate random combinations of parameters for outfitCountFolds testing."""
|
|
92
|
-
parameterSets:
|
|
96
|
+
parameterSets: dict[str, list[Any]] = {
|
|
93
97
|
'computationDivisions': [
|
|
94
98
|
None,
|
|
95
99
|
'maximum',
|
|
@@ -112,7 +116,7 @@ def parameterIterator() -> Callable[[List[int]], Generator[Dict[str, Any], None,
|
|
|
112
116
|
]
|
|
113
117
|
}
|
|
114
118
|
|
|
115
|
-
def makeParametersDynamic(listDimensions:
|
|
119
|
+
def makeParametersDynamic(listDimensions: list[int]) -> dict[str, list[Any]]:
|
|
116
120
|
"""Add context-dependent parameter values."""
|
|
117
121
|
parametersDynamic = parameterSets.copy()
|
|
118
122
|
leavesTotal = getLeavesTotal(listDimensions)
|
|
@@ -137,7 +141,7 @@ def parameterIterator() -> Callable[[List[int]], Generator[Dict[str, Any], None,
|
|
|
137
141
|
|
|
138
142
|
return parametersDynamic
|
|
139
143
|
|
|
140
|
-
def generateCombinations(listDimensions:
|
|
144
|
+
def generateCombinations(listDimensions: list[int]) -> Generator[dict[str, Any], None, None]:
|
|
141
145
|
parametersDynamic = makeParametersDynamic(listDimensions)
|
|
142
146
|
parameterKeys = list(parametersDynamic.keys())
|
|
143
147
|
parameterValues = [parametersDynamic[key] for key in parameterKeys]
|
|
@@ -152,7 +156,7 @@ def parameterIterator() -> Callable[[List[int]], Generator[Dict[str, Any], None,
|
|
|
152
156
|
|
|
153
157
|
return generateCombinations
|
|
154
158
|
|
|
155
|
-
def test_saveFoldsTotal_fallback(pathTmpTesting:
|
|
159
|
+
def test_saveFoldsTotal_fallback(pathTmpTesting: Path) -> None:
|
|
156
160
|
foldsTotal = 123
|
|
157
161
|
pathFilename = pathTmpTesting / "foldsTotal.txt"
|
|
158
162
|
with unittest.mock.patch("pathlib.Path.write_text", side_effect=OSError("Simulated write failure")):
|
tests/test_tasks.py
CHANGED
|
@@ -4,10 +4,10 @@ import pytest
|
|
|
4
4
|
# TODO add a test. `C` = number of logical cores available. `n = C + 1`. Ensure that `[2,n]` is computed correctly.
|
|
5
5
|
# Or, probably smarter: limit the number of cores, then run a test with C+1.
|
|
6
6
|
|
|
7
|
-
def test_countFoldsComputationDivisionsInvalid(listDimensionsTestFunctionality:
|
|
7
|
+
def test_countFoldsComputationDivisionsInvalid(listDimensionsTestFunctionality: list[int]) -> None:
|
|
8
8
|
standardizedEqualTo(ValueError, countFolds, listDimensionsTestFunctionality, None, {"wrong": "value"})
|
|
9
9
|
|
|
10
|
-
def test_countFoldsComputationDivisionsMaximum(listDimensionsTestParallelization:
|
|
10
|
+
def test_countFoldsComputationDivisionsMaximum(listDimensionsTestParallelization: list[int], foldsTotalKnown: dict[tuple[int, ...], int]) -> None:
|
|
11
11
|
standardizedEqualTo(foldsTotalKnown[tuple(listDimensionsTestParallelization)], countFolds, listDimensionsTestParallelization, None, 'maximum')
|
|
12
12
|
|
|
13
13
|
@pytest.mark.parametrize("nameOfTest,callablePytest", PytestFor_defineConcurrencyLimit())
|
|
@@ -15,7 +15,7 @@ def test_defineConcurrencyLimit(nameOfTest: str, callablePytest: Callable[[], No
|
|
|
15
15
|
callablePytest()
|
|
16
16
|
|
|
17
17
|
@pytest.mark.parametrize("CPUlimitParameter", [{"invalid": True}, ["weird"]])
|
|
18
|
-
def test_countFolds_cpuLimitOopsie(listDimensionsTestFunctionality:
|
|
18
|
+
def test_countFolds_cpuLimitOopsie(listDimensionsTestFunctionality: list[int], CPUlimitParameter: dict[str, bool] | list[str]) -> None:
|
|
19
19
|
standardizedEqualTo(ValueError, countFolds, listDimensionsTestFunctionality, None, 'cpu', CPUlimitParameter)
|
|
20
20
|
|
|
21
21
|
@pytest.mark.parametrize("computationDivisions, concurrencyLimit, listDimensions, expectedTaskDivisions", [
|
|
@@ -25,7 +25,7 @@ def test_countFolds_cpuLimitOopsie(listDimensionsTestFunctionality: List[int], C
|
|
|
25
25
|
(["invalid"], 4, [19, 23], ValueError),
|
|
26
26
|
(20, 4, [3,5], ValueError)
|
|
27
27
|
])
|
|
28
|
-
def test_getTaskDivisions(computationDivisions: None |
|
|
28
|
+
def test_getTaskDivisions(computationDivisions: None | list[str] | Literal['maximum'] | Literal['cpu'] | Literal[20], concurrencyLimit: Literal[4], listDimensions: list[int], expectedTaskDivisions: type[ValueError] | Literal[0] | Literal[77] | Literal[4]) -> None:
|
|
29
29
|
standardizedEqualTo(expectedTaskDivisions, getTaskDivisions, computationDivisions, concurrencyLimit, None, listDimensions)
|
|
30
30
|
|
|
31
31
|
@pytest.mark.parametrize("expected,parameter", [
|
|
@@ -35,6 +35,6 @@ def test_getTaskDivisions(computationDivisions: None | List[str] | Literal['maxi
|
|
|
35
35
|
(ValueError, {2}), # set
|
|
36
36
|
(ValueError, {"cores": 2}), # dict
|
|
37
37
|
])
|
|
38
|
-
def test_setCPUlimitMalformedParameter(expected: type[ValueError] | Literal[2], parameter:
|
|
38
|
+
def test_setCPUlimitMalformedParameter(expected: type[ValueError] | Literal[2], parameter: list[int] | tuple[int] | set[int] | dict[str, int] | Literal['2']) -> None:
|
|
39
39
|
"""Test that invalid CPUlimit types are properly handled."""
|
|
40
40
|
standardizedEqualTo(expected, setCPUlimit, parameter)
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
mapFolding/__init__.py,sha256=1-iO5PCGKlW81fhMDjSLrsKxuSeV-UMcU1NlKW352FM,1347
|
|
2
|
-
mapFolding/basecamp.py,sha256=MyrkAbJZawW6CPVEJ_7iPfCYjngdFHmicSs8Ylq5S1E,3787
|
|
3
|
-
mapFolding/beDRY.py,sha256=tDLddJzQoGvbcttJro8ML2B59KspMkZwIeZdm4hOy_4,16785
|
|
4
|
-
mapFolding/oeis.py,sha256=8c6q3STjgp-c4Reode9PLLYS3c00wCsJW-yfte7NI60,11103
|
|
5
|
-
mapFolding/theDao.py,sha256=PZgx_0X7QfdIpLpEO5mbdVNFMCRuP8PD-f62xU7C4U0,12618
|
|
6
|
-
mapFolding/theSSOT.py,sha256=RQmSsjmysc9izjGLsVseZ0J0nDzG_rKY7QkrOF-47SU,5794
|
|
7
|
-
mapFolding/theSSOTdatatypes.py,sha256=H0d1vAn59VCRPMhn28PtlBEZnjmQjEKofiefgvpBFsg,5955
|
|
8
|
-
mapFolding/reference/flattened.py,sha256=S6D9wiFTlbeoetEqaMLOcA-R22BHOzjqPRujffNxxUM,14875
|
|
9
|
-
mapFolding/reference/hunterNumba.py,sha256=jDS0ORHkIhcJ1rzA5hT49sZHKf3rgJOoGesUCcbKFFY,6054
|
|
10
|
-
mapFolding/reference/irvineJavaPort.py,sha256=7GvBU0tnS6wpFgkYad3465do9jBQW-2bYvbCYyABPHM,3341
|
|
11
|
-
mapFolding/reference/jax.py,sha256=7ji9YWia6Kof0cjcNdiS1GG1rMbC5SBjcyVr_07AeUk,13845
|
|
12
|
-
mapFolding/reference/lunnan.py,sha256=iAbJELfW6RKNMdPcBY9b6rGQ-z1zoRf-1XCurCRMOo8,3951
|
|
13
|
-
mapFolding/reference/lunnanNumpy.py,sha256=rwVP3WIDXimpAuaxhRIuBYU56nVDTKlfGiclw_FkgUU,3765
|
|
14
|
-
mapFolding/reference/lunnanWhile.py,sha256=uRrMT23jTJvoQDlD_FzeIQe_pfMXJG6_bRvs7uhC8z0,3271
|
|
15
|
-
mapFolding/reference/rotatedEntryPoint.py,sha256=USZY3n3zwhSE68ATscUuN66t1qShuEbMI790Gz9JFTw,9352
|
|
16
|
-
mapFolding/reference/total_countPlus1vsPlusN.py,sha256=wpgay-uqPOBd64Z4Pg6tg40j7-4pzWHGMM6v0bnmjhE,6288
|
|
17
|
-
mapFolding/someAssemblyRequired/__init__.py,sha256=wtec_hIz-AKz0_hGdXsWnCKTcCxdMV9-WK6SiIriAeU,396
|
|
18
|
-
mapFolding/someAssemblyRequired/getLLVMforNoReason.py,sha256=nX8tghZClYt7zJd6RpZBXhE_h-CGRHOS17biqiEdf-o,855
|
|
19
|
-
mapFolding/someAssemblyRequired/makeJob.py,sha256=c9sTRUK90snTCcXCvs86VKBH6z_nt3OVFjNs_WgCoIg,2422
|
|
20
|
-
mapFolding/someAssemblyRequired/synthesizeModuleJAX.py,sha256=jatvtYhK5ZJK-YmCKATt7w3icFXXO79cZDAYVrU9bgA,1258
|
|
21
|
-
mapFolding/someAssemblyRequired/synthesizeNumba.py,sha256=eJRZ8ttfaONMq-s3BawswJrHu_m0DUHp4dGpx6uVpuk,16920
|
|
22
|
-
mapFolding/someAssemblyRequired/synthesizeNumbaGeneralized.py,sha256=3FiD6fDGzam6uvgTg7YEsGlLftbBOol2ajvEa4GNTec,16698
|
|
23
|
-
mapFolding/someAssemblyRequired/synthesizeNumbaJob.py,sha256=pknX6CeH9iuDTs9tp0gz33T2U5gjO8NMpPnQnnBU2gA,9138
|
|
24
|
-
mapFolding/someAssemblyRequired/synthesizeNumbaModules.py,sha256=V9xpM1r4MQlhXoKLkF2PTg69gid7Ec64pbMc2ZZ2xXo,5590
|
|
25
|
-
mapFolding/syntheticModules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
|
-
mapFolding/syntheticModules/numbaCount.py,sha256=VkTHk97gIBRZg7FwX7hCgfunSBK2Gyr4pp3fzHNrLhw,12907
|
|
27
|
-
mapFolding/syntheticModules/numba_doTheNeedful.py,sha256=9syuZEc1KwH3BFp2TmK7-pBuT2N4lVJTiUhqu7ahaKY,1157
|
|
28
|
-
tests/__init__.py,sha256=eg9smg-6VblOr0kisM40CpGnuDtU2JgEEWGDTFVOlW8,57
|
|
29
|
-
tests/conftest.py,sha256=qP-ZCyyqXC4E9W_psMVbHPlXE-8Ue01fBckGqhzlhGQ,11972
|
|
30
|
-
tests/test_computations.py,sha256=WO28l9AmrFY6kbcx9iJr6YNoqLbZ8Lgs7FryH5DG0BI,2856
|
|
31
|
-
tests/test_oeis.py,sha256=C2F6XrI5oRPjc29lykN3e83rIcgl01UwBLB6L-Qz2pE,4733
|
|
32
|
-
tests/test_other.py,sha256=u0vINT5EyVsXTNTR2DZIMpWCg4FH471jjHLRzC2JX7U,8351
|
|
33
|
-
tests/test_tasks.py,sha256=iq6_dh43JQkC2vAWXua0Xe915BKFGbvRJAkmbco854A,2389
|
|
34
|
-
tests/test_types.py,sha256=58tmPG9WOeGGAQbdQK_h_7t4SnENnZugH4WXlI8-L-M,171
|
|
35
|
-
mapFolding-0.4.3.dist-info/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
|
|
36
|
-
mapFolding-0.4.3.dist-info/METADATA,sha256=52v3PWTTXMbJwXFaUQFAnJilfn29HFiESW83sPFUL1M,7633
|
|
37
|
-
mapFolding-0.4.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
38
|
-
mapFolding-0.4.3.dist-info/entry_points.txt,sha256=F3OUeZR1XDTpoH7k3wXuRb3KF_kXTTeYhu5AGK1SiOQ,146
|
|
39
|
-
mapFolding-0.4.3.dist-info/top_level.txt,sha256=1gP2vFaqPwHujGwb3UjtMlLEGN-943VSYFR7V4gDqW8,17
|
|
40
|
-
mapFolding-0.4.3.dist-info/RECORD,,
|
tests/test_types.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|