From 0cc50725edcd514f954ce7830dfa23979ec25068 Mon Sep 17 00:00:00 2001 From: protolambda Date: Thu, 24 Oct 2019 15:31:43 +0800 Subject: [PATCH] py docs fixes --- test_libs/pyspec/eth2spec/test/context.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test_libs/pyspec/eth2spec/test/context.py b/test_libs/pyspec/eth2spec/test/context.py index 462c50685..33171c4e1 100644 --- a/test_libs/pyspec/eth2spec/test/context.py +++ b/test_libs/pyspec/eth2spec/test/context.py @@ -29,10 +29,18 @@ def with_custom_state(balances_fn: Callable[[Any], Sequence[int]], def default_activation_threshold(spec): + """ + Helper method to use the default balance activation threshold for state creation for tests. + Usage: `@with_custom_state(threshold_fn=default_activation_threshold, ...)` + """ return spec.MAX_EFFECTIVE_BALANCE def default_balances(spec): + """ + Helper method to create a series of default balances. + Usage: `@with_custom_state(balances_fn=default_balances, ...)` + """ num_validators = spec.SLOTS_PER_EPOCH * 8 return [spec.MAX_EFFECTIVE_BALANCE] * num_validators @@ -42,7 +50,8 @@ with_state = with_custom_state(default_balances, default_activation_threshold) def low_balances(spec): """ - Helper method to create a series of low balances. Usage: `@with_validator_balances(low_balances)` + Helper method to create a series of low balances. + Usage: `@with_custom_state(balances_fn=low_balances, ...)` """ num_validators = spec.SLOTS_PER_EPOCH * 8 # Technically the balances cannot be this low starting from genesis, but it is useful for testing @@ -53,7 +62,7 @@ def low_balances(spec): def misc_balances(spec): """ Helper method to create a series of balances that includes some misc. balances. - Usage: `@with_validator_balances(misc_balances)` + Usage: `@with_custom_state(balances_fn=misc_balances, ...)` """ num_validators = spec.SLOTS_PER_EPOCH * 8 num_misc_validators = spec.SLOTS_PER_EPOCH