Add explicit example in hypothesis test, for test coverage
Marco Ricci

Marco Ricci commited on 2024-09-30 10:40:45
Zeige 1 geänderte Dateien mit 15 Einfügungen und 0 Löschungen.


The test coverage otherwise gets flaky.
... ...
@@ -334,6 +334,21 @@ class TestHypotheses:
334 334
         },
335 335
         service='0',
336 336
     )
337
+    # branch coverage: case `repeat = 0` in `if config[repeat]` below
338
+    @hypothesis.example(
339
+        phrase=b'\x00',
340
+        config={
341
+            'lower': 0,
342
+            'upper': 0,
343
+            'number': 0,
344
+            'space': 1,
345
+            'dash': 0,
346
+            'symbol': 0,
347
+            'repeat': 0,
348
+            'length': 5,
349
+        },
350
+        service='0',
351
+    )
337 352
     def test_100_all_length_character_and_occurrence_constraints_satisfied(
338 353
         self,
339 354
         phrase: str | bytes,
340 355