Marco Ricci commited on 2025-08-15 18:26:34
Zeige 9 geänderte Dateien mit 71 Einfügungen und 74 Löschungen.
The existing system of ordinals – loosely modeled on HTTP status codes, but subverted repeatedly because of ad hoc additions or `hypothesis` reimplementations in the test suite – is hopelessly out of sync, and quite an obstacle while refactoring the test suite. Remove them, at least until the test suite is more stable again. On the other hand, there is some value in ordering tests so that – absent any randomization or parallelization of the run order –, the "simpler" or "more fundamental" tests run first: this sometimes provides the needed insight to track down a problem that only manifests in a more cryptic way in the other, more complicated tests. So in the long run, some level of ordering will likely be introduced. But whether this is an ordinal in the test name, or perhaps something more complicated such as a signalling test fixture, or mark, or a custom collection function, or whatever, is still open.
... | ... |
@@ -145,7 +145,7 @@ class Parametrize: |
145 | 145 |
|
146 | 146 |
|
147 | 147 |
@Parametrize.TEST_KEYS |
148 |
-def test_100_test_keys_public_keys_are_internally_consistent( |
|
148 |
+def test_test_keys_public_keys_are_internally_consistent( |
|
149 | 149 |
keyname: str, |
150 | 150 |
key: data.SSHTestKey, |
151 | 151 |
) -> None: |
... | ... |
@@ -161,7 +161,7 @@ def test_100_test_keys_public_keys_are_internally_consistent( |
161 | 161 |
|
162 | 162 |
|
163 | 163 |
@Parametrize.TEST_KEYS |
164 |
-def test_101_test_keys_private_keys_are_consistent_with_public_keys( |
|
164 |
+def test_test_keys_private_keys_are_consistent_with_public_keys( |
|
165 | 165 |
keyname: str, |
166 | 166 |
key: data.SSHTestKey, |
167 | 167 |
) -> None: |
... | ... |
@@ -195,7 +195,7 @@ def test_101_test_keys_private_keys_are_consistent_with_public_keys( |
195 | 195 |
|
196 | 196 |
|
197 | 197 |
@Parametrize.TEST_KEYS |
198 |
-def test_102_test_keys_private_keys_are_internally_consistent( |
|
198 |
+def test_test_keys_private_keys_are_internally_consistent( |
|
199 | 199 |
keyname: str, |
200 | 200 |
key: data.SSHTestKey, |
201 | 201 |
) -> None: |
... | ... |
@@ -386,7 +386,7 @@ class TestHelpOutput: |
386 | 386 |
|
387 | 387 |
# TODO(the-13th-letter): Do we actually need this? What should we |
388 | 388 |
# check for? |
389 |
- def test_100_help_output(self) -> None: |
|
389 |
+ def test_help_output(self) -> None: |
|
390 | 390 |
"""The top-level help text mentions subcommands. |
391 | 391 |
|
392 | 392 |
TODO: Do we actually need this? What should we check for? |
... | ... |
@@ -413,7 +413,7 @@ class TestHelpOutput: |
413 | 413 |
|
414 | 414 |
# TODO(the-13th-letter): Do we actually need this? What should we |
415 | 415 |
# check for? |
416 |
- def test_101_help_output_export( |
|
416 |
+ def test_help_output_export( |
|
417 | 417 |
self, |
418 | 418 |
) -> None: |
419 | 419 |
"""The "export" subcommand help text mentions subcommands. |
... | ... |
@@ -444,7 +444,7 @@ class TestHelpOutput: |
444 | 444 |
|
445 | 445 |
# TODO(the-13th-letter): Do we actually need this? What should we |
446 | 446 |
# check for? |
447 |
- def test_102_help_output_export_vault( |
|
447 |
+ def test_help_output_export_vault( |
|
448 | 448 |
self, |
449 | 449 |
) -> None: |
450 | 450 |
"""The "export vault" subcommand help text has known content. |
... | ... |
@@ -475,7 +475,7 @@ class TestHelpOutput: |
475 | 475 |
|
476 | 476 |
# TODO(the-13th-letter): Do we actually need this? What should we |
477 | 477 |
# check for? |
478 |
- def test_103_help_output_vault( |
|
478 |
+ def test_help_output_vault( |
|
479 | 479 |
self, |
480 | 480 |
) -> None: |
481 | 481 |
"""The "vault" subcommand help text has known content. |
... | ... |
@@ -509,7 +509,7 @@ class TestHelpOutput: |
509 | 509 |
|
510 | 510 |
@Parametrize.COMMAND_NON_EAGER_ARGUMENTS |
511 | 511 |
@Parametrize.EAGER_ARGUMENTS |
512 |
- def test_200_eager_options( |
|
512 |
+ def test_eager_options( |
|
513 | 513 |
self, |
514 | 514 |
command: list[str], |
515 | 515 |
arguments: list[str], |
... | ... |
@@ -537,7 +537,7 @@ class TestHelpOutput: |
537 | 537 |
|
538 | 538 |
@Parametrize.ISATTY |
539 | 539 |
@Parametrize.COLORFUL_COMMAND_INPUT |
540 |
- def test_201_automatic_color_mode( |
|
540 |
+ def test_automatic_color_mode( |
|
541 | 541 |
self, |
542 | 542 |
isatty: bool, |
543 | 543 |
command_line: list[str], |
... | ... |
@@ -178,7 +178,7 @@ class Parametrize(types.SimpleNamespace): |
178 | 178 |
class TestCLI: |
179 | 179 |
"""Test the command-line interface for `derivepassphrase export vault`.""" |
180 | 180 |
|
181 |
- def test_200_path_parameter(self) -> None: |
|
181 |
+ def test_path_parameter(self) -> None: |
|
182 | 182 |
"""The path `VAULT_PATH` is supported. |
183 | 183 |
|
184 | 184 |
Using `VAULT_PATH` as the path looks up the actual path in the |
... | ... |
@@ -208,7 +208,7 @@ class TestCLI: |
208 | 208 |
assert result.clean_exit(empty_stderr=True), "expected clean exit" |
209 | 209 |
assert json.loads(result.stdout) == data.VAULT_V03_CONFIG_DATA |
210 | 210 |
|
211 |
- def test_201_key_parameter(self) -> None: |
|
211 |
+ def test_key_parameter(self) -> None: |
|
212 | 212 |
"""The `--key` option is supported.""" |
213 | 213 |
runner = machinery.CliRunner(mix_stderr=False) |
214 | 214 |
# TODO(the-13th-letter): Rewrite using parenthesized |
... | ... |
@@ -231,7 +231,7 @@ class TestCLI: |
231 | 231 |
assert json.loads(result.stdout) == data.VAULT_V03_CONFIG_DATA |
232 | 232 |
|
233 | 233 |
@pytest_machinery.Parametrize.VAULT_CONFIG_FORMATS_DATA |
234 |
- def test_210_load_vault_v02_v03_storeroom( |
|
234 |
+ def test_load_vault_v02_v03_storeroom( |
|
235 | 235 |
self, |
236 | 236 |
config: str | bytes, |
237 | 237 |
format: str, |
... | ... |
@@ -269,10 +269,7 @@ class TestCLI: |
269 | 269 |
assert result.clean_exit(empty_stderr=True), "expected clean exit" |
270 | 270 |
assert json.loads(result.stdout) == config_data |
271 | 271 |
|
272 |
- # test_300_invalid_format is found in |
|
273 |
- # tests.test_derivepassphrase_export::Test002CLI |
|
274 |
- |
|
275 |
- def test_301_vault_config_not_found( |
|
272 |
+ def test_vault_config_not_found( |
|
276 | 273 |
self, |
277 | 274 |
caplog: pytest.LogCaptureFixture, |
278 | 275 |
) -> None: |
... | ... |
@@ -304,7 +301,7 @@ class TestCLI: |
304 | 301 |
), "expected error exit and known error message" |
305 | 302 |
assert data.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr |
306 | 303 |
|
307 |
- def test_302_vault_config_invalid( |
|
304 |
+ def test_vault_config_invalid( |
|
308 | 305 |
self, |
309 | 306 |
caplog: pytest.LogCaptureFixture, |
310 | 307 |
) -> None: |
... | ... |
@@ -333,7 +330,7 @@ class TestCLI: |
333 | 330 |
), "expected error exit and known error message" |
334 | 331 |
assert data.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr |
335 | 332 |
|
336 |
- def test_302a_vault_config_invalid_just_a_directory( |
|
333 |
+ def test_vault_config_invalid_just_a_directory( |
|
337 | 334 |
self, |
338 | 335 |
caplog: pytest.LogCaptureFixture, |
339 | 336 |
) -> None: |
... | ... |
@@ -365,7 +362,7 @@ class TestCLI: |
365 | 362 |
), "expected error exit and known error message" |
366 | 363 |
assert data.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr |
367 | 364 |
|
368 |
- def test_403_invalid_vault_config_bad_signature( |
|
365 |
+ def test_invalid_vault_config_bad_signature( |
|
369 | 366 |
self, |
370 | 367 |
caplog: pytest.LogCaptureFixture, |
371 | 368 |
) -> None: |
... | ... |
@@ -394,7 +391,7 @@ class TestCLI: |
394 | 391 |
), "expected error exit and known error message" |
395 | 392 |
assert data.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr |
396 | 393 |
|
397 |
- def test_500_vault_config_invalid_internal( |
|
394 |
+ def test_vault_config_invalid_internal( |
|
398 | 395 |
self, |
399 | 396 |
caplog: pytest.LogCaptureFixture, |
400 | 397 |
) -> None: |
... | ... |
@@ -439,7 +436,7 @@ class TestStoreroom: |
439 | 436 |
@Parametrize.PATH |
440 | 437 |
@Parametrize.KEY_FORMATS |
441 | 438 |
@Parametrize.STOREROOM_HANDLER |
442 |
- def test_200_export_data_path_and_keys_type( |
|
439 |
+ def test_export_data_path_and_keys_type( |
|
443 | 440 |
self, |
444 | 441 |
path: str | None, |
445 | 442 |
key: str | Buffer | None, |
... | ... |
@@ -470,7 +467,7 @@ class TestStoreroom: |
470 | 467 |
== data.VAULT_STOREROOM_CONFIG_DATA |
471 | 468 |
) |
472 | 469 |
|
473 |
- def test_400_decrypt_bucket_item_unknown_version(self) -> None: |
|
470 |
+ def test_decrypt_bucket_item_unknown_version(self) -> None: |
|
474 | 471 |
"""Fail on unknown versions of the master keys file.""" |
475 | 472 |
bucket_item = ( |
476 | 473 |
b"\xff" + bytes(storeroom.ENCRYPTED_KEYPAIR_SIZE) + bytes(3) |
... | ... |
@@ -484,7 +481,7 @@ class TestStoreroom: |
484 | 481 |
storeroom._decrypt_bucket_item(bucket_item, master_keys) |
485 | 482 |
|
486 | 483 |
@Parametrize.BAD_CONFIG |
487 |
- def test_401_decrypt_bucket_file_bad_json_or_version( |
|
484 |
+ def test_decrypt_bucket_file_bad_json_or_version( |
|
488 | 485 |
self, |
489 | 486 |
config: str, |
490 | 487 |
) -> None: |
... | ... |
@@ -520,7 +517,7 @@ class TestStoreroom: |
520 | 517 |
|
521 | 518 |
@Parametrize.BAD_MASTER_KEYS_DATA |
522 | 519 |
@Parametrize.STOREROOM_HANDLER |
523 |
- def test_402_export_storeroom_data_bad_master_keys_file( |
|
520 |
+ def test_export_storeroom_data_bad_master_keys_file( |
|
524 | 521 |
self, |
525 | 522 |
master_keys_data: str, |
526 | 523 |
err_msg: str, |
... | ... |
@@ -553,7 +550,7 @@ class TestStoreroom: |
553 | 550 |
|
554 | 551 |
@Parametrize.BAD_STOREROOM_CONFIG_DATA |
555 | 552 |
@Parametrize.STOREROOM_HANDLER |
556 |
- def test_403_export_storeroom_data_bad_directory_listing( |
|
553 |
+ def test_export_storeroom_data_bad_directory_listing( |
|
557 | 554 |
self, |
558 | 555 |
zipped_config: bytes, |
559 | 556 |
error_text: str, |
... | ... |
@@ -590,7 +587,7 @@ class TestStoreroom: |
590 | 587 |
stack.enter_context(pytest.raises(RuntimeError, match=error_text)) |
591 | 588 |
handler(format="storeroom") |
592 | 589 |
|
593 |
- def test_404_decrypt_keys_wrong_data_length(self) -> None: |
|
590 |
+ def test_decrypt_keys_wrong_data_length(self) -> None: |
|
594 | 591 |
"""Fail on internal structural data of the wrong size. |
595 | 592 |
|
596 | 593 |
Specifically, fail on internal structural data such as master |
... | ... |
@@ -646,7 +643,7 @@ class TestStoreroom: |
646 | 643 |
min_size=storeroom.MAC_SIZE, max_size=storeroom.MAC_SIZE |
647 | 644 |
), |
648 | 645 |
) |
649 |
- def test_405_decrypt_keys_invalid_signature(self, data: bytes) -> None: |
|
646 |
+ def test_decrypt_keys_invalid_signature(self, data: bytes) -> None: |
|
650 | 647 |
"""Fail on bad MAC values.""" |
651 | 648 |
key = b"DEADBEEFdeadbeefDeAdBeEfdEaDbEeF" |
652 | 649 |
# Guessing a correct payload plus MAC would be a pre-image |
... | ... |
@@ -671,7 +668,7 @@ class TestVaultNativeConfig: |
671 | 668 |
"""Test the vault-native handler and handler machinery.""" |
672 | 669 |
|
673 | 670 |
@Parametrize.VAULT_NATIVE_PBKDF2_RESULT |
674 |
- def test_200_pbkdf2_manually(self, iterations: int, result: bytes) -> None: |
|
671 |
+ def test_pbkdf2_manually(self, iterations: int, result: bytes) -> None: |
|
675 | 672 |
"""The PBKDF2 helper function works.""" |
676 | 673 |
assert ( |
677 | 674 |
vault_native.VaultNativeConfigParser._pbkdf2( |
... | ... |
@@ -682,7 +679,7 @@ class TestVaultNativeConfig: |
682 | 679 |
|
683 | 680 |
@Parametrize.VAULT_NATIVE_CONFIG_DATA |
684 | 681 |
@Parametrize.VAULT_NATIVE_HANDLER |
685 |
- def test_201_export_vault_native_data_explicit_version( |
|
682 |
+ def test_export_vault_native_data_explicit_version( |
|
686 | 683 |
self, |
687 | 684 |
config: str, |
688 | 685 |
format: Literal["v0.2", "v0.3"], |
... | ... |
@@ -723,7 +720,7 @@ class TestVaultNativeConfig: |
723 | 720 |
@Parametrize.PATH |
724 | 721 |
@Parametrize.KEY_FORMATS |
725 | 722 |
@Parametrize.VAULT_NATIVE_HANDLER |
726 |
- def test_202_export_data_path_and_keys_type( |
|
723 |
+ def test_export_data_path_and_keys_type( |
|
727 | 724 |
self, |
728 | 725 |
path: str | None, |
729 | 726 |
key: str | Buffer | None, |
... | ... |
@@ -754,7 +751,7 @@ class TestVaultNativeConfig: |
754 | 751 |
) |
755 | 752 |
|
756 | 753 |
@Parametrize.VAULT_NATIVE_PARSER_CLASS_DATA |
757 |
- def test_300_result_caching( |
|
754 |
+ def test_result_caching( |
|
758 | 755 |
self, |
759 | 756 |
config: str, |
760 | 757 |
parser_class: type[vault_native.VaultNativeConfigParser], |
... | ... |
@@ -803,7 +800,7 @@ class TestVaultNativeConfig: |
803 | 800 |
super_call = vault_native.VaultNativeConfigParser.__call__ |
804 | 801 |
assert super_call(parser) == config_data |
805 | 802 |
|
806 |
- def test_400_no_password(self) -> None: |
|
803 |
+ def test_no_password(self) -> None: |
|
807 | 804 |
"""Fail on empty master keys/master passphrases.""" |
808 | 805 |
with pytest.raises(ValueError, match="Password must not be empty"): |
809 | 806 |
vault_native.VaultNativeV03ConfigParser(b"", b"") |
... | ... |
@@ -51,7 +51,7 @@ class Parametrize(types.SimpleNamespace): |
51 | 51 |
) |
52 | 52 |
|
53 | 53 |
|
54 |
-class Test001ExporterUtils: |
|
54 |
+class TestUtilities: |
|
55 | 55 |
"""Test the utility functions in the `exporter` subpackage.""" |
56 | 56 |
|
57 | 57 |
class VaultKeyEnvironment(NamedTuple): |
... | ... |
@@ -87,7 +87,7 @@ class Test001ExporterUtils: |
87 | 87 |
def strategy( |
88 | 88 |
draw: strategies.DrawFn, |
89 | 89 |
allow_missing: bool = False, |
90 |
- ) -> Test001ExporterUtils.VaultKeyEnvironment: |
|
90 |
+ ) -> TestUtilities.VaultKeyEnvironment: |
|
91 | 91 |
"""Return a vault key environment configuration.""" |
92 | 92 |
text_strategy = strategies.text( |
93 | 93 |
strategies.characters(min_codepoint=32, max_codepoint=127), |
... | ... |
@@ -100,7 +100,7 @@ class Test001ExporterUtils: |
100 | 100 |
) |
101 | 101 |
num_fields = sum( |
102 | 102 |
1 |
103 |
- for f in Test001ExporterUtils.VaultKeyEnvironment._fields |
|
103 |
+ for f in TestUtilities.VaultKeyEnvironment._fields |
|
104 | 104 |
if f != "expected" |
105 | 105 |
) |
106 | 106 |
env_vars: list[str | None] = draw( |
... | ... |
@@ -124,7 +124,7 @@ class Test001ExporterUtils: |
124 | 124 |
for value in reversed(env_vars): |
125 | 125 |
if value is not None: |
126 | 126 |
expected = value |
127 |
- return Test001ExporterUtils.VaultKeyEnvironment( |
|
127 |
+ return TestUtilities.VaultKeyEnvironment( |
|
128 | 128 |
expected, *env_vars |
129 | 129 |
) |
130 | 130 |
|
... | ... |
@@ -188,7 +188,7 @@ class Test001ExporterUtils: |
188 | 188 |
lambda env: bool(env.expected) |
189 | 189 |
), |
190 | 190 |
) |
191 |
- def test_200_get_vault_key( |
|
191 |
+ def test_get_vault_key( |
|
192 | 192 |
self, |
193 | 193 |
vault_key_env: VaultKeyEnvironment, |
194 | 194 |
) -> None: |
... | ... |
@@ -223,7 +223,7 @@ class Test001ExporterUtils: |
223 | 223 |
assert os.fsdecode(exporter.get_vault_key()) == expected |
224 | 224 |
|
225 | 225 |
@Parametrize.EXPECTED_VAULT_PATH |
226 |
- def test_210_get_vault_path( |
|
226 |
+ def test_get_vault_path( |
|
227 | 227 |
self, |
228 | 228 |
expected: pathlib.Path, |
229 | 229 |
path: str | os.PathLike[str] | None, |
... | ... |
@@ -276,7 +276,7 @@ class Test001ExporterUtils: |
276 | 276 |
) |
277 | 277 |
), |
278 | 278 |
) |
279 |
- def test_220_register_export_vault_config_data_handler( |
|
279 |
+ def test_register_export_vault_config_data_handler( |
|
280 | 280 |
self, name_data: tuple[list[str], list[str]] |
281 | 281 |
) -> None: |
282 | 282 |
"""Register vault config data export handlers.""" |
... | ... |
@@ -301,7 +301,7 @@ class Test001ExporterUtils: |
301 | 301 |
assert dec(handler) == handler |
302 | 302 |
assert registry == dict.fromkeys(names1 + names2, handler) |
303 | 303 |
|
304 |
- def test_300_get_vault_key_without_envs(self) -> None: |
|
304 |
+ def test_get_vault_key_without_envs(self) -> None: |
|
305 | 305 |
"""Fail to look up the vault key in the empty environment.""" |
306 | 306 |
with pytest.MonkeyPatch.context() as monkeypatch: |
307 | 307 |
monkeypatch.delenv("VAULT_KEY", raising=False) |
... | ... |
@@ -311,7 +311,7 @@ class Test001ExporterUtils: |
311 | 311 |
with pytest.raises(KeyError, match="VAULT_KEY"): |
312 | 312 |
exporter.get_vault_key() |
313 | 313 |
|
314 |
- def test_310_get_vault_path_without_home(self) -> None: |
|
314 |
+ def test_get_vault_path_without_home(self) -> None: |
|
315 | 315 |
"""Fail to look up the vault path without `HOME`.""" |
316 | 316 |
|
317 | 317 |
def raiser(*_args: Any, **_kwargs: Any) -> Any: |
... | ... |
@@ -326,7 +326,7 @@ class Test001ExporterUtils: |
326 | 326 |
exporter.get_vault_path() |
327 | 327 |
|
328 | 328 |
@Parametrize.EXPORT_VAULT_CONFIG_DATA_HANDLER_NAMELISTS |
329 |
- def test_320_register_export_vault_config_data_handler_errors( |
|
329 |
+ def test_register_export_vault_config_data_handler_errors( |
|
330 | 330 |
self, |
331 | 331 |
namelist: tuple[str, ...], |
332 | 332 |
err_pat: str, |
... | ... |
@@ -357,7 +357,7 @@ class Test001ExporterUtils: |
357 | 357 |
handler |
358 | 358 |
) |
359 | 359 |
|
360 |
- def test_321_export_vault_config_data_bad_handler(self) -> None: |
|
360 |
+ def test_export_vault_config_data_bad_handler(self) -> None: |
|
361 | 361 |
"""Fail to export vault config data without known handlers.""" |
362 | 362 |
with pytest.MonkeyPatch.context() as monkeypatch: |
363 | 363 |
monkeypatch.setattr( |
... | ... |
@@ -373,10 +373,10 @@ class Test001ExporterUtils: |
373 | 373 |
exporter.export_vault_config_data(format="v0.3") |
374 | 374 |
|
375 | 375 |
|
376 |
-class Test002CLI: |
|
376 |
+class TestCLI: |
|
377 | 377 |
"""Test the command-line functionality of the `exporter` subpackage.""" |
378 | 378 |
|
379 |
- def test_300_invalid_format(self) -> None: |
|
379 |
+ def test_invalid_format(self) -> None: |
|
380 | 380 |
"""Reject invalid vault configuration format names.""" |
381 | 381 |
runner = machinery.CliRunner(mix_stderr=False) |
382 | 382 |
# TODO(the-13th-letter): Rewrite using parenthesized |
... | ... |
@@ -404,7 +404,7 @@ class Test002CLI: |
404 | 404 |
|
405 | 405 |
@pytest_machinery.skip_if_cryptography_support |
406 | 406 |
@pytest_machinery.Parametrize.VAULT_CONFIG_FORMATS_DATA |
407 |
- def test_999_no_cryptography_error_message( |
|
407 |
+ def test_no_cryptography_error_message( |
|
408 | 408 |
self, |
409 | 409 |
caplog: pytest.LogCaptureFixture, |
410 | 410 |
config: str | bytes, |
... | ... |
@@ -84,7 +84,7 @@ class TestStaticFunctionality: |
84 | 84 |
@hypothesis.given( |
85 | 85 |
num=strategies.integers(min_value=0, max_value=0xFFFFFFFFFFFFFFFF), |
86 | 86 |
) |
87 |
- def test_100_bits(self, num: int) -> None: |
|
87 |
+ def test_bits(self, num: int) -> None: |
|
88 | 88 |
"""Extract the bits from a number in big-endian format.""" |
89 | 89 |
seq1 = bits(num) |
90 | 90 |
n = len(seq1) |
... | ... |
@@ -101,7 +101,7 @@ class TestStaticFunctionality: |
101 | 101 |
@hypothesis.given( |
102 | 102 |
num=strategies.integers(min_value=0, max_value=0xFFFFFFFFFFFFFFFF), |
103 | 103 |
) |
104 |
- def test_101_bits(self, num: int) -> None: |
|
104 |
+ def test_bits_bitseq(self, num: int) -> None: |
|
105 | 105 |
"""Extract the bits from a number in big-endian format.""" |
106 | 106 |
text1 = f"{num:064b}" |
107 | 107 |
seq1 = bitseq(text1) |
... | ... |
@@ -112,7 +112,7 @@ class TestStaticFunctionality: |
112 | 112 |
|
113 | 113 |
class BigEndianNumberTest(NamedTuple): |
114 | 114 |
"""Test data for |
115 |
- [`TestStaticFunctionality.test_200_big_endian_number`][]. |
|
115 |
+ [`TestStaticFunctionality.test_big_endian_number`][]. |
|
116 | 116 |
|
117 | 117 |
Attributes: |
118 | 118 |
sequence: A sequence of integers. |
... | ... |
@@ -186,7 +186,7 @@ class TestStaticFunctionality: |
186 | 186 |
@hypothesis.example(BigEndianNumberTest([1, 7, 5, 5], 8, 0o1755)).via( |
187 | 187 |
"manual octal example" |
188 | 188 |
) |
189 |
- def test_200_big_endian_number( |
|
189 |
+ def test_big_endian_number( |
|
190 | 190 |
self, test_case: BigEndianNumberTest |
191 | 191 |
) -> None: |
192 | 192 |
"""Conversion to big endian numbers in any base works. |
... | ... |
@@ -200,7 +200,7 @@ class TestStaticFunctionality: |
200 | 200 |
) == expected |
201 | 201 |
|
202 | 202 |
@Parametrize.BIG_ENDIAN_NUMBER_EXCEPTIONS |
203 |
- def test_300_big_endian_number_exceptions( |
|
203 |
+ def test_big_endian_number_exceptions( |
|
204 | 204 |
self, |
205 | 205 |
exc_type: type[Exception], |
206 | 206 |
exc_pattern: str, |
... | ... |
@@ -319,7 +319,7 @@ class TestSequin: |
319 | 319 |
@hypothesis.example( |
320 | 320 |
ConstructorTestCase("OK", False, bitseq("0100111101001011")) |
321 | 321 |
).via("manual example latin1 text") |
322 |
- def test_200_constructor( |
|
322 |
+ def test_constructor( |
|
323 | 323 |
self, |
324 | 324 |
test_case: ConstructorTestCase, |
325 | 325 |
) -> None: |
... | ... |
@@ -378,7 +378,7 @@ class TestSequin: |
378 | 378 |
) |
379 | 379 |
).via("manual, pre-hypothesis parametrization value") |
380 | 380 |
@hypothesis.given(sequence=GenerationSequence.strategy()) |
381 |
- def test_201_generating(self, sequence: GenerationSequence) -> None: |
|
381 |
+ def test_generating(self, sequence: GenerationSequence) -> None: |
|
382 | 382 |
"""The sequin generates deterministic sequences.""" |
383 | 383 |
seq = sequin.Sequin(sequence.bit_sequence, is_bitstring=True) |
384 | 384 |
for i, (num, result) in enumerate(sequence.steps, start=1): |
... | ... |
@@ -397,7 +397,7 @@ class TestSequin: |
397 | 397 |
f"but generated {result2:d} instead" |
398 | 398 |
) |
399 | 399 |
|
400 |
- def test_201a_generating_errors(self) -> None: |
|
400 |
+ def test_generating_errors(self) -> None: |
|
401 | 401 |
"""The sequin errors deterministically when generating sequences.""" |
402 | 402 |
seq = sequin.Sequin( |
403 | 403 |
[1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1], is_bitstring=True |
... | ... |
@@ -419,7 +419,7 @@ class TestSequin: |
419 | 419 |
) |
420 | 420 |
).via("manual, pre-hypothesis parametrization value") |
421 | 421 |
@hypothesis.given(sequence=GenerationSequence.strategy()) |
422 |
- def test_210_internal_generating( |
|
422 |
+ def test_internal_generating( |
|
423 | 423 |
self, sequence: GenerationSequence |
424 | 424 |
) -> None: |
425 | 425 |
"""The sequin internals generate deterministic sequences.""" |
... | ... |
@@ -440,7 +440,7 @@ class TestSequin: |
440 | 440 |
f"but generated {result2:d} instead" |
441 | 441 |
) |
442 | 442 |
|
443 |
- def test_210a_internal_generating_errors(self) -> None: |
|
443 |
+ def test_internal_generating_errors(self) -> None: |
|
444 | 444 |
"""The sequin generation internals error deterministically.""" |
445 | 445 |
seq = sequin.Sequin( |
446 | 446 |
[1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1], is_bitstring=True |
... | ... |
@@ -516,7 +516,7 @@ class TestSequin: |
516 | 516 |
], |
517 | 517 |
) |
518 | 518 |
) |
519 |
- def test_211_shifting(self, sequence: ShiftSequence) -> None: |
|
519 |
+ def test_shifting(self, sequence: ShiftSequence) -> None: |
|
520 | 520 |
"""The sequin manages the pool of remaining entropy for each base. |
521 | 521 |
|
522 | 522 |
Specifically, the sequin implements all-or-nothing fixed-length |
... | ... |
@@ -542,7 +542,7 @@ class TestSequin: |
542 | 542 |
) |
543 | 543 |
|
544 | 544 |
@Parametrize.INVALID_SEQUIN_INPUTS |
545 |
- def test_300_constructor_exceptions( |
|
545 |
+ def test_constructor_exceptions( |
|
546 | 546 |
self, |
547 | 547 |
sequence: list[int] | str, |
548 | 548 |
is_bitstring: bool, |
... | ... |
@@ -806,7 +806,7 @@ class TestShellExportScriptParsing: |
806 | 806 |
class TestGracefulFailureForSSHAuthSock: |
807 | 807 |
"""Test the `posix` socket provider if `SSH_AUTH_SOCK` is unset.""" |
808 | 808 |
|
809 |
- def test_200_constructor_posix_no_ssh_auth_sock( |
|
809 |
+ def test_constructor_posix_no_ssh_auth_sock( |
|
810 | 810 |
self, |
811 | 811 |
skip_if_no_af_unix_support: None, |
812 | 812 |
) -> None: |
... | ... |
@@ -34,7 +34,7 @@ class Parametrize(types.SimpleNamespace): |
34 | 34 |
|
35 | 35 |
|
36 | 36 |
@Parametrize.VALID_VAULT_TEST_CONFIGS |
37 |
-def test_200_is_vault_config(test_config: data.VaultTestConfig) -> None: |
|
37 |
+def test_is_vault_config(test_config: data.VaultTestConfig) -> None: |
|
38 | 38 |
"""Is this vault configuration recognized as valid/invalid? |
39 | 39 |
|
40 | 40 |
Check all test configurations that do not need custom validation |
... | ... |
@@ -61,7 +61,7 @@ def test_200_is_vault_config(test_config: data.VaultTestConfig) -> None: |
61 | 61 |
]) |
62 | 62 |
) |
63 | 63 |
) |
64 |
-def test_200a_is_vault_config_smudged( |
|
64 |
+def test_is_vault_config_smudged( |
|
65 | 65 |
test_config: data.VaultTestConfig, |
66 | 66 |
) -> None: |
67 | 67 |
"""Is this vault configuration recognized as valid/invalid? |
... | ... |
@@ -87,7 +87,7 @@ def test_200a_is_vault_config_smudged( |
87 | 87 |
|
88 | 88 |
|
89 | 89 |
@Parametrize.VAULT_TEST_CONFIGS |
90 |
-def test_400_validate_vault_config( |
|
90 |
+def test_validate_vault_config( |
|
91 | 91 |
test_config: data.VaultTestConfig, |
92 | 92 |
) -> None: |
93 | 93 |
"""Validate this vault configuration. |
... | ... |
@@ -126,7 +126,7 @@ def test_400_validate_vault_config( |
126 | 126 |
]) |
127 | 127 |
) |
128 | 128 |
) |
129 |
-def test_400a_validate_vault_config_smudged( |
|
129 |
+def test_validate_vault_config_smudged( |
|
130 | 130 |
test_config: data.VaultTestConfig, |
131 | 131 |
) -> None: |
132 | 132 |
"""Validate this vault configuration. |
... | ... |
@@ -69,7 +69,7 @@ def js_nested_strategy(draw: strategies.DrawFn) -> Any: |
69 | 69 |
|
70 | 70 |
@hypothesis.given(value=js_nested_strategy()) |
71 | 71 |
@hypothesis.example(float("nan")) |
72 |
-def test_100_js_truthiness(value: Any) -> None: |
|
72 |
+def test_js_truthiness(value: Any) -> None: |
|
73 | 73 |
"""Determine the truthiness of a value according to JavaScript. |
74 | 74 |
|
75 | 75 |
Use hypothesis to generate test values. |
... | ... |
@@ -89,13 +89,13 @@ class TestL10nMachineryWithDebugTranslations: |
89 | 89 |
|
90 | 90 |
@hypothesis.given(value=strategies.text(max_size=100)) |
91 | 91 |
@hypothesis.example("{") |
92 |
- def test_100_debug_translation_get_str(self, value: str) -> None: |
|
92 |
+ def test_debug_translation_get_str(self, value: str) -> None: |
|
93 | 93 |
"""Translating a raw string object does nothing.""" |
94 | 94 |
translated = msg.translation.gettext(value) |
95 | 95 |
assert translated == value |
96 | 96 |
|
97 | 97 |
@hypothesis.given(value=strategies.sampled_from(all_translatable_strings)) |
98 |
- def test_100a_debug_translation_get_ts( |
|
98 |
+ def test_debug_translation_get_ts( |
|
99 | 99 |
self, |
100 | 100 |
value: msg.TranslatableString, |
101 | 101 |
) -> None: |
... | ... |
@@ -111,7 +111,7 @@ class TestL10nMachineryWithDebugTranslations: |
111 | 111 |
@hypothesis.given( |
112 | 112 |
value=strategies.sampled_from(all_translatable_strings_enum_values) |
113 | 113 |
) |
114 |
- def test_100b_debug_translation_get_enum( |
|
114 |
+ def test_debug_translation_get_enum( |
|
115 | 115 |
self, |
116 | 116 |
value: msg.MsgTemplate, |
117 | 117 |
) -> None: |
... | ... |
@@ -127,7 +127,7 @@ class TestL10nMachineryWithDebugTranslations: |
127 | 127 |
|
128 | 128 |
@hypothesis.given(value=strategies.text(max_size=100)) |
129 | 129 |
@hypothesis.example("{") |
130 |
- def test_100c_debug_translation_get_ts_str(self, value: str) -> None: |
|
130 |
+ def test_debug_translation_get_ts_str(self, value: str) -> None: |
|
131 | 131 |
"""Translating a constant TranslatableString does nothing.""" |
132 | 132 |
translated = msg.TranslatedString.constant(value) |
133 | 133 |
assert str(translated) == value |
... | ... |
@@ -140,7 +140,7 @@ class TestL10nMachineryWithDebugTranslations: |
140 | 140 |
unique=True, |
141 | 141 |
) |
142 | 142 |
) |
143 |
- def test_101_translated_strings_operations( |
|
143 |
+ def test_translated_strings_operations( |
|
144 | 144 |
self, |
145 | 145 |
values: list[msg.MsgTemplate], |
146 | 146 |
) -> None: |
... | ... |
@@ -167,7 +167,7 @@ class TestL10nMachineryWithDebugTranslations: |
167 | 167 |
unique=True, |
168 | 168 |
), |
169 | 169 |
) |
170 |
- def test_101a_translated_strings_operations_interpolated( |
|
170 |
+ def test_translated_strings_operations_interpolated( |
|
171 | 171 |
self, |
172 | 172 |
value: msg.ErrMsgTemplate, |
173 | 173 |
errnos: list[int], |
... | ... |
@@ -191,7 +191,7 @@ class TestL10nMachineryWithDebugTranslations: |
191 | 191 |
value=strategies.sampled_from(known_fields_error_messages), |
192 | 192 |
errno_=strategies.sampled_from(error_codes), |
193 | 193 |
) |
194 |
- def test_101b_translated_strings_operations_interpolated( |
|
194 |
+ def test_translated_strings_operations_interpolated_error_and_filename( |
|
195 | 195 |
self, |
196 | 196 |
value: msg.ErrMsgTemplate, |
197 | 197 |
errno_: int, |
... | ... |
@@ -214,7 +214,7 @@ class TestL10nMachineryWithDebugTranslations: |
214 | 214 |
assert len({ts0, ts1}) == 2 |
215 | 215 |
|
216 | 216 |
@Parametrize.MAYBE_FORMAT_STRINGS |
217 |
- def test_102_translated_strings_suppressed_interpolation_fail( |
|
217 |
+ def test_translated_strings_suppressed_interpolation_fail( |
|
218 | 218 |
self, |
219 | 219 |
s: str, |
220 | 220 |
) -> None: |
... | ... |
@@ -256,7 +256,7 @@ class TestL10nMachineryWithDebugTranslations: |
256 | 256 |
max_size=20, |
257 | 257 |
) |
258 | 258 |
) |
259 |
- def test_102a_translated_strings_suppressed_interpolation_str( |
|
259 |
+ def test_translated_strings_suppressed_interpolation_str( |
|
260 | 260 |
self, |
261 | 261 |
s: str, |
262 | 262 |
) -> None: |
... | ... |
@@ -278,7 +278,7 @@ class TestL10nMachineryWithDebugTranslations: |
278 | 278 |
max_size=20, |
279 | 279 |
) |
280 | 280 |
) |
281 |
- def test_102b_translated_strings_suppressed_interpolation_ts_manual( |
|
281 |
+ def test_translated_strings_suppressed_interpolation_ts_manual( |
|
282 | 282 |
self, |
283 | 283 |
s: str, |
284 | 284 |
) -> None: |
285 | 285 |