Skip to content

Commit bcdf4e3

Browse files
committed
Avoid mutation on fixture params
1 parent c87eb38 commit bcdf4e3

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

tests/beacon/test_helpers.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -895,8 +895,17 @@ def test_verify_slashable_vote_data_signature(privkeys,
895895
genesis_validators,
896896
sample_slashable_vote_data_params,
897897
sample_fork_data_params):
898-
sample_beacon_state_params["validator_registry"] = genesis_validators
899-
state = BeaconState(**sample_beacon_state_params)
898+
beacon_state_params_with_genesis_validators = assoc(
899+
sample_beacon_state_params,
900+
"validator_registry",
901+
genesis_validators,
902+
)
903+
beacon_state_params_with_fork_data = assoc(
904+
beacon_state_params_with_genesis_validators,
905+
"fork_data",
906+
ForkData(**sample_fork_data_params),
907+
)
908+
state = BeaconState(**beacon_state_params_with_fork_data)
900909

901910
# NOTE: we can do this before "correcting" the params as they
902911
# touch disjoint subsets of the provided params
@@ -951,8 +960,17 @@ def test_verify_slashable_vote_data(param_mapper,
951960
sample_slashable_vote_data_params,
952961
sample_fork_data_params,
953962
max_casper_votes):
954-
sample_beacon_state_params["validator_registry"] = genesis_validators
955-
state = BeaconState(**sample_beacon_state_params)
963+
beacon_state_params_with_genesis_validators = assoc(
964+
sample_beacon_state_params,
965+
"validator_registry",
966+
genesis_validators,
967+
)
968+
beacon_state_params_with_fork_data = assoc(
969+
beacon_state_params_with_genesis_validators,
970+
"fork_data",
971+
ForkData(**sample_fork_data_params),
972+
)
973+
state = BeaconState(**beacon_state_params_with_fork_data)
956974

957975
# NOTE: we can do this before "correcting" the params as they
958976
# touch disjoint subsets of the provided params

0 commit comments

Comments
 (0)