Document hypothesis examples for "vault" tests the proper way
Marco Ricci

Marco Ricci commited on 2025-01-26 23:40:15
Zeige 1 geänderte Dateien mit 3 Einfügungen und 6 Löschungen.


Use `hypothesis.example(...).via(...)` instead of source code comments.
... ...
@@ -169,7 +169,6 @@ class TestVault:
169 169
         config=tests.vault_full_service_config(),
170 170
         service=strategies.text(min_size=1),
171 171
     )
172
-    # regression test
173 172
     @hypothesis.example(
174 173
         phrase=b'\x00',
175 174
         config={
... ...
@@ -183,8 +182,7 @@ class TestVault:
183 182
             'length': 3,
184 183
         },
185 184
         service='0',
186
-    )
187
-    # regression test
185
+    ).via('regression test')
188 186
     @hypothesis.example(
189 187
         phrase=b'\x00',
190 188
         config={
... ...
@@ -198,8 +196,7 @@ class TestVault:
198 196
             'length': 5,
199 197
         },
200 198
         service='0',
201
-    )
202
-    # branch coverage: case `repeat = 0` in `if config[repeat]` below
199
+    ).via('regression test')
203 200
     @hypothesis.example(
204 201
         phrase=b'\x00',
205 202
         config={
... ...
@@ -213,7 +210,7 @@ class TestVault:
213 210
             'length': 5,
214 211
         },
215 212
         service='0',
216
-    )
213
+    ).via('branch coverage (test function): "no repeats" case')
217 214
     def test_217a_all_length_character_and_occurrence_constraints_satisfied(
218 215
         self,
219 216
         phrase: str | bytes,
220 217