@@ -163,15 +163,15 @@ def valid_cases():
163
163
for mode in modes :
164
164
for variation in range (3 ):
165
165
yield f'{ name } _{ mode .to_name ()} _chaos_{ variation } ' , \
166
- valid_test_case (lambda : container_case_fn (rng , mode , typ , chaos = True ))
166
+ valid_test_case (lambda : container_case_fn (rng , mode , typ , chaos = True ))
167
167
# Notes: Below is the second wave of iteration, and only the random mode is selected
168
168
# for container without offset since ``RandomizationMode.mode_zero`` and ``RandomizationMode.mode_max``
169
169
# are deterministic.
170
170
modes = [RandomizationMode .mode_random ] if len (offsets ) == 0 else list (RandomizationMode )
171
171
for mode in modes :
172
172
for variation in range (10 ):
173
173
yield f'{ name } _{ mode .to_name ()} _{ variation } ' , \
174
- valid_test_case (lambda : container_case_fn (rng , mode , typ ))
174
+ valid_test_case (lambda : container_case_fn (rng , mode , typ ))
175
175
176
176
177
177
def mod_offset (b : bytes , offset_index : int , change : Callable [[int ], int ]):
@@ -186,8 +186,8 @@ def invalid_cases():
186
186
for (name , (typ , offsets )) in PRESET_CONTAINERS .items ():
187
187
# using mode_max_count, so that the extra byte cannot be picked up as normal list content
188
188
yield f'{ name } _extra_byte' , \
189
- invalid_test_case (lambda : serialize (
190
- container_case_fn (rng , RandomizationMode .mode_max_count , typ )) + b'\xff ' )
189
+ invalid_test_case (lambda : serialize (
190
+ container_case_fn (rng , RandomizationMode .mode_max_count , typ )) + b'\xff ' )
191
191
192
192
if len (offsets ) != 0 :
193
193
# Note: there are many more ways to have invalid offsets,
@@ -198,23 +198,23 @@ def invalid_cases():
198
198
RandomizationMode .mode_max_count ]:
199
199
for index , offset_index in enumerate (offsets ):
200
200
yield f'{ name } _{ mode .to_name ()} _offset_{ offset_index } _plus_one' , \
201
- invalid_test_case (lambda : mod_offset (
202
- b = serialize (container_case_fn (rng , mode , typ )),
203
- offset_index = offset_index ,
204
- change = lambda x : x + 1
205
- ))
201
+ invalid_test_case (lambda : mod_offset (
202
+ b = serialize (container_case_fn (rng , mode , typ )),
203
+ offset_index = offset_index ,
204
+ change = lambda x : x + 1
205
+ ))
206
206
yield f'{ name } _{ mode .to_name ()} _offset_{ offset_index } _zeroed' , \
207
- invalid_test_case (lambda : mod_offset (
208
- b = serialize (container_case_fn (rng , mode , typ )),
209
- offset_index = offset_index ,
210
- change = lambda x : 0
211
- ))
207
+ invalid_test_case (lambda : mod_offset (
208
+ b = serialize (container_case_fn (rng , mode , typ )),
209
+ offset_index = offset_index ,
210
+ change = lambda x : 0
211
+ ))
212
212
if index == 0 :
213
213
yield f'{ name } _{ mode .to_name ()} _offset_{ offset_index } _minus_one' , \
214
214
invalid_test_case (lambda : mod_offset (
215
- b = serialize (container_case_fn (rng , mode , typ )),
216
- offset_index = offset_index ,
217
- change = lambda x : x - 1
215
+ b = serialize (container_case_fn (rng , mode , typ )),
216
+ offset_index = offset_index ,
217
+ change = lambda x : x - 1
218
218
))
219
219
if mode == RandomizationMode .mode_max_count :
220
220
serialized = serialize (container_case_fn (rng , mode , typ ))
0 commit comments