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.
@@ -6,5 +6,4 @@ Note: These test functions are now in `hunterMakesPy.tests` with all other tests
6
6
  """
7
7
 
8
8
  from hunterMakesPy.tests.test_parseParameters import (
9
- PytestFor_defineConcurrencyLimit as PytestFor_defineConcurrencyLimit, PytestFor_intInnit as PytestFor_intInnit,
10
- PytestFor_oopsieKwargsie as PytestFor_oopsieKwargsie)
9
+ PytestFor_defineConcurrencyLimit, PytestFor_intInnit, PytestFor_oopsieKwargsie)
@@ -1,3 +1,11 @@
1
+ """Configuration and fixtures for pytest.
2
+
3
+ (AI generated docstring)
4
+
5
+ This module provides shared fixtures and utility functions for the test suite,
6
+ including data paths, source code samples, and standardized assertion helpers.
7
+
8
+ """
1
9
  # pyright: standard
2
10
  from collections.abc import Callable
3
11
  from typing import Any
@@ -6,11 +14,26 @@ import pathlib
6
14
  import pytest
7
15
 
8
16
  # SSOT for test data paths and filenames
9
- pathDataSamples = pathlib.Path("hunterMakesPy/tests/dataSamples")
17
+ pathDataSamples: pathlib.Path = pathlib.Path("hunterMakesPy/tests/dataSamples")
10
18
 
11
19
  # Fixture to provide a temporary directory for filesystem tests
12
20
  @pytest.fixture
13
21
  def pathTmpTesting(tmp_path: pathlib.Path) -> pathlib.Path:
22
+ """Provide a temporary directory for filesystem tests.
23
+
24
+ (AI generated docstring)
25
+
26
+ Parameters
27
+ ----------
28
+ tmp_path : pathlib.Path
29
+ The pytest built-in temporary path fixture.
30
+
31
+ Returns
32
+ -------
33
+ pathTmpTesting : pathlib.Path
34
+ The path to the temporary directory.
35
+
36
+ """
14
37
  return tmp_path
15
38
 
16
39
  # Fixture for predictable Python source code samples
@@ -44,7 +67,27 @@ def listFileContentsFibonacci() -> list[str]:
44
67
  return ['fibonacci8', 'fibonacci13', 'fibonacci21', 'fibonacci34']
45
68
 
46
69
  def uniformTestFailureMessage(expected: Any, actual: Any, functionName: str, *arguments: Any, **keywordArguments: Any) -> str:
47
- """Format assertion message for any test comparison."""
70
+ """Format assertion message for any test comparison.
71
+
72
+ Parameters
73
+ ----------
74
+ expected : Any
75
+ The expected value or outcome.
76
+ actual : Any
77
+ The actual value or outcome received.
78
+ functionName : str
79
+ The name of the function or test case being executed.
80
+ *arguments : Any
81
+ Positional arguments passed to the function having its return value checked.
82
+ **keywordArguments : Any
83
+ Keyword arguments passed to the function having its return value checked.
84
+
85
+ Returns
86
+ -------
87
+ message : str
88
+ A formatted failure message detailing the expectation vs reality.
89
+
90
+ """
48
91
  listArgumentComponents: list[str] = [str(parameter) for parameter in arguments]
49
92
  listKeywordComponents: list[str] = [f"{key}={value}" for key, value in keywordArguments.items()]
50
93
  joinedArguments: str = ', '.join(listArgumentComponents + listKeywordComponents)
@@ -54,7 +97,22 @@ def uniformTestFailureMessage(expected: Any, actual: Any, functionName: str, *ar
54
97
  f"Got: {actual}")
55
98
 
56
99
  def standardizedEqualTo(expected: Any, functionTarget: Callable[..., Any], *arguments: Any, **keywordArguments: Any) -> None:
57
- """Template for most tests to compare the actual outcome with the expected outcome, including expected errors."""
100
+ """Template for most tests to compare actual outcome with expected outcome.
101
+
102
+ Includes handling for expected errors/exceptions.
103
+
104
+ Parameters
105
+ ----------
106
+ expected : Any
107
+ The expected return value, or an Exception type if an error is expected.
108
+ functionTarget : Callable[..., Any]
109
+ The function to call and test.
110
+ *arguments : Any
111
+ Positional arguments to pass to `functionTarget`.
112
+ **keywordArguments : Any
113
+ Keyword arguments to pass to `functionTarget`.
114
+
115
+ """
58
116
  if type(expected) == type[Exception]: # noqa: E721
59
117
  messageExpected: str = expected.__name__
60
118
  else:
@@ -63,7 +121,23 @@ def standardizedEqualTo(expected: Any, functionTarget: Callable[..., Any], *argu
63
121
  try:
64
122
  messageActual = actual = functionTarget(*arguments, **keywordArguments)
65
123
  except Exception as actualError:
66
- messageActual: str = type(actualError).__name__
124
+ messageActual = type(actualError).__name__
67
125
  actual = type(actualError)
68
126
 
69
- assert actual == expected, uniformTestFailureMessage(messageExpected, messageActual, functionTarget.__name__, *arguments, **keywordArguments)
127
+ functionName: str = getattr(functionTarget, "__name__", functionTarget.__class__.__name__)
128
+ assert actual == expected, uniformTestFailureMessage(messageExpected, messageActual, functionName, *arguments, **keywordArguments)
129
+
130
+ # Why I wish I could figure out how to implement standardized* test functions.
131
+ # ruff: noqa: ERA001
132
+ # standardizedEqualTo(expected, updateExtendPolishDictionaryLists, *value_dictionaryLists, **keywordArguments)
133
+ # NOTE one line of code with `standardizedEqualTo` (above) replaced the following ten lines of code. Use `standardizedEqualTo`.
134
+ # if isinstance(expected, type) and issubclass(expected, Exception):
135
+ # with pytest.raises(expected):
136
+ # updateExtendPolishDictionaryLists(*value_dictionaryLists, **keywordArguments)
137
+ # else:
138
+ # result = updateExtendPolishDictionaryLists(*value_dictionaryLists, **keywordArguments)
139
+ # if description == "Set values": # Special handling for unordered sets
140
+ # for key in result:
141
+ # assert sorted(result[key]) == sorted(expected[key])
142
+ # else:
143
+ # assert result == expected
@@ -1,3 +1,11 @@
1
+ """Tests for the coping mechanism module.
2
+
3
+ (AI generated docstring)
4
+
5
+ This module validates the behavior of package setting retrieval,
6
+ null-check utilities, and installation path resolution.
7
+
8
+ """
1
9
  from hunterMakesPy import PackageSettings, raiseIfNone
2
10
  from hunterMakesPy.coping import getIdentifierPackagePACKAGING, getPathPackageINSTALLING
3
11
  from hunterMakesPy.tests.conftest import uniformTestFailureMessage
@@ -5,212 +13,309 @@ from pathlib import Path
5
13
  import pytest
6
14
 
7
15
  @pytest.mark.parametrize(
8
- "returnTarget, expected",
9
- [
10
- (13, 13),
11
- (17, 17),
12
- ("fibonacci", "fibonacci"),
13
- ("prime", "prime"),
14
- ([], []),
15
- ({}, {}),
16
- (False, False),
17
- (0, 0),
18
- ]
16
+ "returnTarget, expected",
17
+ [
18
+ (13, 13),
19
+ (17, 17),
20
+ ("fibonacci", "fibonacci"),
21
+ ("prime", "prime"),
22
+ ([], []),
23
+ ({}, {}),
24
+ (False, False),
25
+ (0, 0),
26
+ ]
19
27
  )
20
28
  def testRaiseIfNoneReturnsNonNoneValues(returnTarget: object, expected: object) -> None:
21
- actual = raiseIfNone(returnTarget)
22
- assert actual == expected, uniformTestFailureMessage(expected, actual, "testRaiseIfNoneReturnsNonNoneValues", returnTarget)
23
- assert actual is returnTarget, uniformTestFailureMessage(returnTarget, actual, "testRaiseIfNoneReturnsNonNoneValues identity check", returnTarget)
29
+ """Verify that non-None values are returned exactly as provided.
30
+
31
+ (AI generated docstring)
24
32
 
33
+ Parameters
34
+ ----------
35
+ returnTarget : object
36
+ The value to pass to `raiseIfNone`.
37
+ expected : object
38
+ The expected return value (should be identical to `returnTarget`).
39
+
40
+ """
41
+ actual: object = raiseIfNone(returnTarget)
42
+ assert actual == expected, uniformTestFailureMessage(expected, actual, "testRaiseIfNoneReturnsNonNoneValues", returnTarget)
43
+ assert actual is returnTarget, uniformTestFailureMessage(returnTarget, actual, "testRaiseIfNoneReturnsNonNoneValues identity check", returnTarget)
25
44
 
26
45
  def testRaiseIfNoneRaisesValueErrorWhenGivenNone() -> None:
27
- with pytest.raises(ValueError, match="A function unexpectedly returned `None`. Hint: look at the traceback immediately before `raiseIfNone`."):
28
- raiseIfNone(None)
46
+ """Verify that ValueError is raised when input is None.
47
+
48
+ (AI generated docstring)
29
49
 
50
+ """
51
+ with pytest.raises(ValueError, match=r"A function unexpectedly returned `None`.*"):
52
+ raiseIfNone(None)
30
53
 
31
54
  @pytest.mark.parametrize(
32
- "customMessage",
33
- [
34
- "Configuration must include 'host' setting",
35
- "Database connection failed",
36
- "User input is required",
37
- "Network request returned empty response",
38
- ]
55
+ "customMessage",
56
+ [
57
+ "Configuration must include 'host' setting",
58
+ "Database connection failed",
59
+ "User input is required",
60
+ "Network request returned empty response",
61
+ ]
39
62
  )
40
63
  def testRaiseIfNoneRaisesValueErrorWithCustomMessage(customMessage: str) -> None:
41
- with pytest.raises(ValueError, match=customMessage):
42
- raiseIfNone(None, customMessage)
64
+ """Verify that custom error messages are used when provided.
65
+
66
+ (AI generated docstring)
43
67
 
68
+ Parameters
69
+ ----------
70
+ customMessage : str
71
+ The custom error message to expect.
72
+
73
+ """
74
+ with pytest.raises(ValueError, match=customMessage):
75
+ raiseIfNone(None, customMessage)
44
76
 
45
77
  def testRaiseIfNoneWithEmptyStringMessage() -> None:
46
- with pytest.raises(ValueError, match="A function unexpectedly returned `None`. Hint: look at the traceback immediately before `raiseIfNone`."):
47
- raiseIfNone(None, "")
78
+ """Verify that empty custom message string triggers default message.
79
+
80
+ (AI generated docstring)
48
81
 
82
+ """
83
+ with pytest.raises(ValueError, match=r"A function unexpectedly returned `None`.*"):
84
+ raiseIfNone(None, "")
49
85
 
50
86
  def testRaiseIfNonePreservesTypeAnnotations() -> None:
51
- integerValue: int = raiseIfNone(23)
52
- assert isinstance(integerValue, int), uniformTestFailureMessage(int, type(integerValue), "testRaiseIfNonePreservesTypeAnnotations", integerValue)
87
+ """Verify that type info is preserved through the pass-through.
88
+
89
+ (AI generated docstring)
53
90
 
54
- stringValue: str = raiseIfNone("cardinal")
55
- assert isinstance(stringValue, str), uniformTestFailureMessage(str, type(stringValue), "testRaiseIfNonePreservesTypeAnnotations", stringValue)
91
+ """
92
+ integerValue: int = raiseIfNone(23)
93
+ assert isinstance(integerValue, int), uniformTestFailureMessage(int, type(integerValue), "testRaiseIfNonePreservesTypeAnnotations", integerValue)
56
94
 
57
- listValue: list[int] = raiseIfNone([29, 31])
58
- assert isinstance(listValue, list), uniformTestFailureMessage(list, type(listValue), "testRaiseIfNonePreservesTypeAnnotations", listValue)
95
+ stringValue: str = raiseIfNone("cardinal")
96
+ assert isinstance(stringValue, str), uniformTestFailureMessage(str, type(stringValue), "testRaiseIfNonePreservesTypeAnnotations", stringValue)
97
+
98
+ listValue: list[int] = raiseIfNone([29, 31])
99
+ assert isinstance(listValue, list), uniformTestFailureMessage(list, type(listValue), "testRaiseIfNonePreservesTypeAnnotations", listValue)
59
100
 
60
101
  # Tests for PackageSettings dataclass
61
102
  @pytest.mark.parametrize(
62
- "identifierPackageFALLBACK, expectedIdentifierPackage",
63
- [
64
- ("astToolFactory", "hunterMakesPy"), # Should read from pyproject.toml
65
- ("nonExistentPackage", "hunterMakesPy"), # Should read from pyproject.toml
66
- ("customPackage", "hunterMakesPy"), # Should read from pyproject.toml
67
- ]
103
+ "identifierPackageFALLBACK, expectedIdentifierPackage",
104
+ [
105
+ ("astToolFactory", "hunterMakesPy"), # Should read from pyproject.toml
106
+ ("nonExistentPackage", "hunterMakesPy"), # Should read from pyproject.toml
107
+ ("customPackage", "hunterMakesPy"), # Should read from pyproject.toml
108
+ ]
68
109
  )
69
110
  def testPackageSettingsWithFallbackUsesProjectToml(identifierPackageFALLBACK: str, expectedIdentifierPackage: str) -> None:
70
- """Test that PackageSettings reads package name from pyproject.toml when using fallback."""
71
- packageSettings = PackageSettings(identifierPackageFALLBACK)
72
- assert packageSettings.identifierPackage == expectedIdentifierPackage, uniformTestFailureMessage(
73
- expectedIdentifierPackage, packageSettings.identifierPackage, "PackageSettings fallback", identifierPackageFALLBACK
74
- )
111
+ """Test that PackageSettings reads package name from pyproject.toml when using fallback.
112
+
113
+ Parameters
114
+ ----------
115
+ identifierPackageFALLBACK : str
116
+ The fallback identifier to use if retrieval fails (or to trigger lookup).
117
+ expectedIdentifierPackage : str
118
+ The expected resolved package identifier.
119
+
120
+ """
121
+ packageSettings: PackageSettings = PackageSettings(identifierPackageFALLBACK)
122
+ assert packageSettings.identifierPackage == expectedIdentifierPackage, uniformTestFailureMessage(
123
+ expectedIdentifierPackage, packageSettings.identifierPackage, "PackageSettings fallback", identifierPackageFALLBACK
124
+ )
75
125
 
76
126
  @pytest.mark.parametrize(
77
- "explicitIdentifierPackage, expectedIdentifierPackage",
78
- [
79
- ("customPackageName", "customPackageName"),
80
- ("fibonacci", "fibonacci"),
81
- ("prime", "prime"),
82
- ("astToolFactory", "astToolFactory"),
83
- ]
127
+ "explicitIdentifierPackage, expectedIdentifierPackage",
128
+ [
129
+ ("customPackageName", "customPackageName"),
130
+ ("fibonacci", "fibonacci"),
131
+ ("prime", "prime"),
132
+ ("astToolFactory", "astToolFactory"),
133
+ ]
84
134
  )
85
135
  def testPackageSettingsWithExplicitIdentifierPackage(explicitIdentifierPackage: str, expectedIdentifierPackage: str) -> None:
86
- """Test that PackageSettings respects explicitly provided identifierPackage."""
87
- packageSettings = PackageSettings(identifierPackage=explicitIdentifierPackage)
88
- assert packageSettings.identifierPackage == expectedIdentifierPackage, uniformTestFailureMessage(
89
- expectedIdentifierPackage, packageSettings.identifierPackage, "PackageSettings explicit identifierPackage", explicitIdentifierPackage
90
- )
136
+ """Test that PackageSettings respects explicitly provided identifierPackage.
137
+
138
+ Parameters
139
+ ----------
140
+ explicitIdentifierPackage : str
141
+ The explicitly provided package identifier.
142
+ expectedIdentifierPackage : str
143
+ The expected resolved package identifier.
144
+
145
+ """
146
+ packageSettings: PackageSettings = PackageSettings(identifierPackage=explicitIdentifierPackage)
147
+ assert packageSettings.identifierPackage == expectedIdentifierPackage, uniformTestFailureMessage(
148
+ expectedIdentifierPackage, packageSettings.identifierPackage, "PackageSettings explicit identifierPackage", explicitIdentifierPackage
149
+ )
91
150
 
92
151
  @pytest.mark.parametrize(
93
- "explicitPathPackage, expectedPathPackage",
94
- [
95
- (Path("C:/fibonacci/path"), Path("C:/fibonacci/path")),
96
- (Path("C:/prime/directory"), Path("C:/prime/directory")),
97
- (Path("/usr/local/lib/package"), Path("/usr/local/lib/package")),
98
- (Path("relative/path"), Path("relative/path")),
99
- ]
152
+ "explicitPathPackage, expectedPathPackage",
153
+ [
154
+ (Path("C:/fibonacci/path"), Path("C:/fibonacci/path")),
155
+ (Path("C:/prime/directory"), Path("C:/prime/directory")),
156
+ (Path("/usr/local/lib/package"), Path("/usr/local/lib/package")),
157
+ (Path("relative/path"), Path("relative/path")),
158
+ ]
100
159
  )
101
160
  def testPackageSettingsWithExplicitPathPackage(explicitPathPackage: Path, expectedPathPackage: Path) -> None:
102
- """Test that PackageSettings respects explicitly provided pathPackage."""
103
- packageSettings = PackageSettings(pathPackage=explicitPathPackage)
104
- assert packageSettings.pathPackage == expectedPathPackage, uniformTestFailureMessage(
105
- expectedPathPackage, packageSettings.pathPackage, "PackageSettings explicit pathPackage", explicitPathPackage
106
- )
161
+ """Test that PackageSettings respects explicitly provided pathPackage.
162
+
163
+ Parameters
164
+ ----------
165
+ explicitPathPackage : Path
166
+ The explicitly provided package path.
167
+ expectedPathPackage : Path
168
+ The expected resolved package path.
169
+
170
+ """
171
+ packageSettings: PackageSettings = PackageSettings(pathPackage=explicitPathPackage)
172
+ assert packageSettings.pathPackage == expectedPathPackage, uniformTestFailureMessage(
173
+ expectedPathPackage, packageSettings.pathPackage, "PackageSettings explicit pathPackage", explicitPathPackage
174
+ )
107
175
 
108
176
  @pytest.mark.parametrize(
109
- "fileExtension, expectedFileExtension",
110
- [
111
- (".fibonacci", ".fibonacci"),
112
- (".prime", ".prime"),
113
- (".txt", ".txt"),
114
- (".md", ".md"),
115
- (".json", ".json"),
116
- ]
177
+ "fileExtension, expectedFileExtension",
178
+ [
179
+ (".fibonacci", ".fibonacci"),
180
+ (".prime", ".prime"),
181
+ (".txt", ".txt"),
182
+ (".md", ".md"),
183
+ (".json", ".json"),
184
+ ]
117
185
  )
118
186
  def testPackageSettingsWithCustomFileExtension(fileExtension: str, expectedFileExtension: str) -> None:
119
- """Test that PackageSettings respects custom file extensions."""
120
- packageSettings = PackageSettings(fileExtension=fileExtension)
121
- assert packageSettings.fileExtension == expectedFileExtension, uniformTestFailureMessage(
122
- expectedFileExtension, packageSettings.fileExtension, "PackageSettings custom fileExtension", fileExtension
123
- )
187
+ """Test that PackageSettings respects custom file extensions.
188
+
189
+ Parameters
190
+ ----------
191
+ fileExtension : str
192
+ The custom file extension to set.
193
+ expectedFileExtension : str
194
+ The expected file extension in the settings.
195
+
196
+ """
197
+ packageSettings: PackageSettings = PackageSettings(fileExtension=fileExtension)
198
+ assert packageSettings.fileExtension == expectedFileExtension, uniformTestFailureMessage(
199
+ expectedFileExtension, packageSettings.fileExtension, "PackageSettings custom fileExtension", fileExtension
200
+ )
124
201
 
125
202
  def testPackageSettingsDefaultValues() -> None:
126
- """Test that PackageSettings has correct default values when no arguments provided."""
127
- packageSettings = PackageSettings()
203
+ """Test that PackageSettings has correct default values when no arguments provided."""
204
+ packageSettings: PackageSettings = PackageSettings()
128
205
 
129
- # Should have default file extension
130
- assert packageSettings.fileExtension == '.py', uniformTestFailureMessage(
131
- '.py', packageSettings.fileExtension, "PackageSettings default fileExtension"
132
- )
206
+ # Should have default file extension
207
+ assert packageSettings.fileExtension == '.py', uniformTestFailureMessage(
208
+ '.py', packageSettings.fileExtension, "PackageSettings default fileExtension"
209
+ )
133
210
 
134
- # identifierPackage should be empty when no fallback provided
135
- assert packageSettings.identifierPackage == '', uniformTestFailureMessage(
136
- '', packageSettings.identifierPackage, "PackageSettings default identifierPackage"
137
- )
211
+ # identifierPackage should be empty when no fallback provided
212
+ assert packageSettings.identifierPackage == '', uniformTestFailureMessage(
213
+ '', packageSettings.identifierPackage, "PackageSettings default identifierPackage"
214
+ )
138
215
 
139
- # pathPackage should remain as Path() when identifierPackage is empty
140
- expectedPath = Path()
141
- assert packageSettings.pathPackage == expectedPath, uniformTestFailureMessage(
142
- expectedPath, packageSettings.pathPackage, "PackageSettings default pathPackage"
143
- )
216
+ expectedPath: Path = Path()
217
+ assert packageSettings.pathPackage == expectedPath, uniformTestFailureMessage(
218
+ expectedPath, packageSettings.pathPackage, "PackageSettings default pathPackage, pathPackage should remain as Path() when identifierPackage is empty"
219
+ )
144
220
 
145
221
  @pytest.mark.parametrize(
146
- "identifierPackageFALLBACK, identifierPackage, pathPackage, fileExtension",
147
- [
148
- ("fallback", "custom", Path("C:/custom/path"), ".txt"),
149
- ("fibonacci", "prime", Path("C:/fibonacci/lib"), ".md"),
150
- ("defaultFallback", "overridePackage", Path("/usr/local/override"), ".json"),
151
- ]
222
+ "identifierPackageFALLBACK, identifierPackage, pathPackage, fileExtension",
223
+ [
224
+ ("fallback", "custom", Path("C:/custom/path"), ".txt"),
225
+ ("fibonacci", "prime", Path("C:/fibonacci/lib"), ".md"),
226
+ ("defaultFallback", "overridePackage", Path("/usr/local/override"), ".json"),
227
+ ]
152
228
  )
153
229
  def testPackageSettingsAllParametersCombined(
154
- identifierPackageFALLBACK: str,
155
- identifierPackage: str,
156
- pathPackage: Path,
157
- fileExtension: str
230
+ identifierPackageFALLBACK: str,
231
+ identifierPackage: str,
232
+ pathPackage: Path,
233
+ fileExtension: str
158
234
  ) -> None:
159
- """Test PackageSettings with all parameters provided."""
160
- packageSettings = PackageSettings(
161
- identifierPackageFALLBACK,
162
- identifierPackage=identifierPackage,
163
- pathPackage=pathPackage,
164
- fileExtension=fileExtension
165
- )
166
-
167
- assert packageSettings.identifierPackage == identifierPackage, uniformTestFailureMessage(
168
- identifierPackage, packageSettings.identifierPackage, "PackageSettings combined identifierPackage"
169
- )
170
- assert packageSettings.pathPackage == pathPackage, uniformTestFailureMessage(
171
- pathPackage, packageSettings.pathPackage, "PackageSettings combined pathPackage"
172
- )
173
- assert packageSettings.fileExtension == fileExtension, uniformTestFailureMessage(
174
- fileExtension, packageSettings.fileExtension, "PackageSettings combined fileExtension"
175
- )
235
+ """Test PackageSettings with all parameters provided.
236
+
237
+ Parameters
238
+ ----------
239
+ identifierPackageFALLBACK : str
240
+ The fallback identifier.
241
+ identifierPackage : str
242
+ The explicit package identifier.
243
+ pathPackage : Path
244
+ The explicit package path.
245
+ fileExtension : str
246
+ The explicit file extension.
247
+
248
+ """
249
+ packageSettings: PackageSettings = PackageSettings(
250
+ identifierPackageFALLBACK
251
+ , identifierPackage=identifierPackage
252
+ , pathPackage=pathPackage
253
+ , fileExtension=fileExtension
254
+ )
255
+
256
+ assert packageSettings.identifierPackage == identifierPackage, uniformTestFailureMessage(
257
+ identifierPackage, packageSettings.identifierPackage, "PackageSettings combined identifierPackage"
258
+ )
259
+ assert packageSettings.pathPackage == pathPackage, uniformTestFailureMessage(
260
+ pathPackage, packageSettings.pathPackage, "PackageSettings combined pathPackage"
261
+ )
262
+ assert packageSettings.fileExtension == fileExtension, uniformTestFailureMessage(
263
+ fileExtension, packageSettings.fileExtension, "PackageSettings combined fileExtension"
264
+ )
176
265
 
177
266
  def testPackageSettingsFallbackIgnoredWhenExplicitIdentifierProvided() -> None:
178
- """Test that fallback is ignored when explicit identifierPackage is provided."""
179
- packageSettings = PackageSettings("shouldBeIgnored", identifierPackage="explicit")
180
- assert packageSettings.identifierPackage == "explicit", uniformTestFailureMessage(
181
- "explicit", packageSettings.identifierPackage, "PackageSettings fallback ignored"
182
- )
267
+ """Test that fallback is ignored when explicit identifierPackage is provided."""
268
+ packageSettings: PackageSettings = PackageSettings("shouldBeIgnored", identifierPackage="explicit")
269
+ assert packageSettings.identifierPackage == "explicit", uniformTestFailureMessage(
270
+ "explicit", packageSettings.identifierPackage, "PackageSettings fallback ignored"
271
+ )
183
272
 
184
273
  # Tests for helper functions
185
274
  @pytest.mark.parametrize(
186
- "identifierPackageFALLBACK, expectedResult",
187
- [
188
- ("fibonacci", "hunterMakesPy"), # Should read from pyproject.toml
189
- ("prime", "hunterMakesPy"), # Should read from pyproject.toml
190
- ("nonExistentPackage", "hunterMakesPy"), # Should read from pyproject.toml
191
- ]
275
+ "identifierPackageFALLBACK, expectedResult",
276
+ [
277
+ ("fibonacci", "hunterMakesPy"), # Should read from pyproject.toml
278
+ ("prime", "hunterMakesPy"), # Should read from pyproject.toml
279
+ ("nonExistentPackage", "hunterMakesPy"), # Should read from pyproject.toml
280
+ ]
192
281
  )
193
282
  def testGetIdentifierPackagePACKAGING(identifierPackageFALLBACK: str, expectedResult: str) -> None:
194
- """Test that getIdentifierPackagePACKAGING reads from pyproject.toml correctly."""
195
- actual = getIdentifierPackagePACKAGING(identifierPackageFALLBACK)
196
- assert actual == expectedResult, uniformTestFailureMessage(
197
- expectedResult, actual, "getIdentifierPackagePACKAGING", identifierPackageFALLBACK
198
- )
283
+ """Test that getIdentifierPackagePACKAGING reads from pyproject.toml correctly.
284
+
285
+ Parameters
286
+ ----------
287
+ identifierPackageFALLBACK : str
288
+ The fallback identifier to provide.
289
+ expectedResult : str
290
+ The expected package identifier result.
291
+
292
+ """
293
+ actual: str = getIdentifierPackagePACKAGING(identifierPackageFALLBACK)
294
+ assert actual == expectedResult, uniformTestFailureMessage(
295
+ expectedResult, actual, "getIdentifierPackagePACKAGING", identifierPackageFALLBACK
296
+ )
199
297
 
200
298
  @pytest.mark.parametrize(
201
- "identifierPackage",
202
- [
203
- "hunterMakesPy", # This package exists
204
- "fibonacci", # Non-existent package should fallback to cwd
205
- "prime", # Non-existent package should fallback to cwd
206
- ]
299
+ "identifierPackage",
300
+ [
301
+ "hunterMakesPy", # This package exists
302
+ "fibonacci", # Non-existent package should fallback to cwd
303
+ "prime", # Non-existent package should fallback to cwd
304
+ ]
207
305
  )
208
306
  def testGetPathPackageINSTALLING(identifierPackage: str) -> None:
209
- """Test that getPathPackageINSTALLING returns valid Path objects."""
210
- actual = getPathPackageINSTALLING(identifierPackage)
211
- assert isinstance(actual, Path), uniformTestFailureMessage(
212
- Path, type(actual), "getPathPackageINSTALLING type", identifierPackage
213
- )
214
- assert actual.exists() or actual == Path.cwd(), uniformTestFailureMessage(
215
- "existing path or cwd", actual, "getPathPackageINSTALLING existence", identifierPackage
216
- )
307
+ """Test that getPathPackageINSTALLING returns valid Path objects.
308
+
309
+ Parameters
310
+ ----------
311
+ identifierPackage : str
312
+ The package identifier to look up.
313
+
314
+ """
315
+ actual: Path = getPathPackageINSTALLING(identifierPackage)
316
+ assert isinstance(actual, Path), uniformTestFailureMessage(
317
+ Path, type(actual), "getPathPackageINSTALLING type", identifierPackage
318
+ )
319
+ assert actual.exists() or actual == Path.cwd(), uniformTestFailureMessage(
320
+ "existing path or cwd", actual, "getPathPackageINSTALLING existence", identifierPackage
321
+ )