From 5612e7a9ee0abb7410932d06d6e6c41ff64c4f83 Mon Sep 17 00:00:00 2001 From: WenceslasSANCHEZ Date: Thu, 3 Aug 2023 18:19:33 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/generators/ssz_generic/ssz_container.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/generators/ssz_generic/ssz_container.py b/tests/generators/ssz_generic/ssz_container.py index 84c7d8df5..e3d0ed3c6 100644 --- a/tests/generators/ssz_generic/ssz_container.py +++ b/tests/generators/ssz_generic/ssz_container.py @@ -69,8 +69,9 @@ def valid_cases(): for mode in [RandomizationMode.mode_zero, RandomizationMode.mode_max]: yield f'{name}_{mode.to_name()}', valid_test_case(lambda: container_case_fn(rng, mode, typ)) - modes = [RandomizationMode.mode_random, RandomizationMode.mode_zero, RandomizationMode.mode_max] - if len(offsets) != 0: + if len(offsets) == 0: + modes = [RandomizationMode.mode_random, RandomizationMode.mode_zero, RandomizationMode.mode_max] + else: modes = list(RandomizationMode) for mode in modes: @@ -80,12 +81,7 @@ def valid_cases(): # Notes: Below is the second wave of iteration, and only the random mode is selected # for container without offset since ``RandomizationMode.mode_zero`` and ``RandomizationMode.mode_max`` # are deterministic. - modes = [RandomizationMode.mode_random] - if len(offsets) != 0: - # Notes: ``RandomizationMode.mode_zero`` and ``RandomizationMode.mode_max`` are - # pseudo-random modes for containers that contains List of Bitlist - # (because the length of List and Bitlist are randoms). - modes = list(RandomizationMode) + modes = [RandomizationMode.mode_random] if len(offsets) != 0 else list(RandomizationMode) for mode in modes: for variation in range(10): yield f'{name}_{mode.to_name()}_{variation}', \