From b38802ced06aab88e919f66adecafa13e3c58112 Mon Sep 17 00:00:00 2001 From: protolambda Date: Sun, 30 Jun 2019 15:27:31 +0200 Subject: [PATCH] accept yielded lists, encode per item --- test_libs/pyspec/eth2spec/test/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test_libs/pyspec/eth2spec/test/utils.py b/test_libs/pyspec/eth2spec/test/utils.py index 817c952b7..bc91053e8 100644 --- a/test_libs/pyspec/eth2spec/test/utils.py +++ b/test_libs/pyspec/eth2spec/test/utils.py @@ -1,6 +1,6 @@ from typing import Dict, Any, Callable, Iterable from eth2spec.debug.encode import encode -from eth2spec.utils.ssz.ssz_typing import Container +from eth2spec.utils.ssz.ssz_typing import SSZValue def spectest(description: str = None): @@ -31,8 +31,10 @@ def spectest(description: str = None): else: # Otherwise, try to infer the type, but keep it as-is if it's not a SSZ container. (key, value) = data - if isinstance(value, Container): + if isinstance(value, SSZValue): out[key] = encode(value, value.__class__) + elif isinstance(value, list) and all([isinstance(el, SSZValue) for el in value]): + out[key] = [encode(el, el.__class__) for el in value] else: # not a ssz value. # It could be vector or bytes still, but it is a rare case,