Skip to content

Commit

Permalink
Apply PR feedback from @michaelsproul
Browse files Browse the repository at this point in the history
  • Loading branch information
hwwhww committed Sep 2, 2022
1 parent ac717b1 commit b9cb5a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions tests/core/pyspec/eth2spec/gen_helpers/gen_base/gen_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from typing import Iterable, AnyStr, Any, Callable
import traceback

import ruamel
from ruamel.yaml import (
YAML,
)
Expand Down Expand Up @@ -98,6 +99,11 @@ def run_generator(generator_name, test_providers: Iterable[TestProvider]):
yaml = YAML(pure=True)
yaml.default_flow_style = None

def _represent_none(self, _):
return self.represent_scalar('tag:yaml.org,2002:null', 'null')

yaml.representer.add_representer(type(None), _represent_none)

# Spec config is using a YAML subset
cfg_yaml = YAML(pure=True)
cfg_yaml.default_flow_style = False # Emit separate line for each key
Expand Down
7 changes: 4 additions & 3 deletions tests/core/pyspec/eth2spec/test/helpers/optimistic_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class PayloadStatusV1:
@property
def formatted_output(self):
return {
'status': str(self.status),
'latest_valid_hash': encode_hex(self.latest_valid_hash) if self.latest_valid_hash is not None else 'null',
'validation_error': str(self.validation_error) if self.validation_error is not None else 'null'
'status': str(self.status.value),
'latest_valid_hash': encode_hex(self.latest_valid_hash) if self.latest_valid_hash is not None else None,
'validation_error': str(self.validation_error) if self.validation_error is not None else None
}


Expand Down Expand Up @@ -95,6 +95,7 @@ def add_optimistic_block(spec, mega_store, signed_block, test_steps,

mega_store.block_payload_statuses[block_root] = payload_status
test_steps.append({
'block_hash': encode_hex(el_block_hash),
'payload_status': payload_status.formatted_output,
})

Expand Down

0 comments on commit b9cb5a5

Please sign in to comment.