From ff15d0bc390ebd340aa3aba2a4e2836048b572a3 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Thu, 7 Oct 2021 16:04:06 +0800 Subject: [PATCH] Apply PR feedback from @ralexstokes --- tests/core/pyspec/eth2spec/gen_helpers/gen_from_tests/gen.py | 4 ++-- tests/core/pyspec/eth2spec/test/altair/sanity/test_blocks.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/core/pyspec/eth2spec/gen_helpers/gen_from_tests/gen.py b/tests/core/pyspec/eth2spec/gen_helpers/gen_from_tests/gen.py index 65a9fe46d..328b7edf1 100644 --- a/tests/core/pyspec/eth2spec/gen_helpers/gen_from_tests/gen.py +++ b/tests/core/pyspec/eth2spec/gen_helpers/gen_from_tests/gen.py @@ -118,11 +118,11 @@ def combine_mods(dict_1, dict_2): # The duplicate dict_1 items would be ignored here. dict_3 = {**dict_1, **dict_2} - intersection = list(dict_1.keys() & dict_2.keys()) + intersection = dict_1.keys() & dict_2.keys() for key in intersection: # To list if not isinstance(dict_3[key], List): - dict_3[key] = [dict_3[key], ] + dict_3[key] = [dict_3[key]] # Append dict_1 value to list if isinstance(dict_1[key], List): dict_3[key] += dict_1[key] diff --git a/tests/core/pyspec/eth2spec/test/altair/sanity/test_blocks.py b/tests/core/pyspec/eth2spec/test/altair/sanity/test_blocks.py index 581ab6fdd..058db2ee6 100644 --- a/tests/core/pyspec/eth2spec/test/altair/sanity/test_blocks.py +++ b/tests/core/pyspec/eth2spec/test/altair/sanity/test_blocks.py @@ -23,8 +23,8 @@ from eth2spec.test.helpers.inactivity_scores import randomize_inactivity_scores def run_sync_committee_sanity_test(spec, state, fraction_full=1.0, rng=Random(454545)): all_pubkeys = [v.pubkey for v in state.validators] committee = [all_pubkeys.index(pubkey) for pubkey in state.current_sync_committee.pubkeys] - selected_indices = rng.sample(list(range(len(committee))), int(len(committee) * fraction_full)) - sync_committee_bits = [True if i in selected_indices else False for i in range(len(committee))] + selected_indices = rng.sample(range(len(committee)), int(len(committee) * fraction_full)) + sync_committee_bits = [i in selected_indices for i in range(len(committee))] participants = [ validator_index for i, validator_index in enumerate(committee)