PythonExtra/tests/basics/namedtuple_asdict.py
Paul Sokolovsky bdceea1d12 tests/basics/namedtuple*: Import ucollections first.
Otherwise, test may have artefacts in the presence of the micropython-lib
module.
2018-06-27 14:58:14 +10:00

21 lines
384 B
Python

try:
try:
from ucollections import namedtuple
except ImportError:
from collections import namedtuple
except ImportError:
print("SKIP")
raise SystemExit
t = namedtuple("Tup", ["baz", "foo", "bar"])(3, 2, 5)
try:
t._asdict
except AttributeError:
print("SKIP")
raise SystemExit
d = t._asdict()
print(list(d.keys()))
print(list(d.values()))