Skip to content

Commit

Permalink
Merge pull request #2791 from ralexstokes/clean-up-test-gen
Browse files Browse the repository at this point in the history
remove unnecessary conditional in ssz generic test gen code
  • Loading branch information
hwwhww committed Jan 7, 2022
2 parents a829802 + d74cb5c commit fab4cb0
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions tests/generators/ssz_generic/ssz_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,16 @@ def invalid_cases():
RandomizationMode.mode_nil_count,
RandomizationMode.mode_one_count,
RandomizationMode.mode_max_count]:
if len(offsets) != 0:
for offset_index in offsets:
yield f'{name}_{mode.to_name()}_offset_{offset_index}_plus_one', \
invalid_test_case(lambda: mod_offset(
b=serialize(container_case_fn(rng, mode, typ)),
offset_index=offset_index,
change=lambda x: x + 1
))
yield f'{name}_{mode.to_name()}_offset_{offset_index}_zeroed', \
invalid_test_case(lambda: mod_offset(
b=serialize(container_case_fn(rng, mode, typ)),
offset_index=offset_index,
change=lambda x: 0
))
for offset_index in offsets:
yield f'{name}_{mode.to_name()}_offset_{offset_index}_plus_one', \
invalid_test_case(lambda: mod_offset(
b=serialize(container_case_fn(rng, mode, typ)),
offset_index=offset_index,
change=lambda x: x + 1
))
yield f'{name}_{mode.to_name()}_offset_{offset_index}_zeroed', \
invalid_test_case(lambda: mod_offset(
b=serialize(container_case_fn(rng, mode, typ)),
offset_index=offset_index,
change=lambda x: 0
))

0 comments on commit fab4cb0

Please sign in to comment.