circuitpython/tests/basics/namedtuple1_cpython_compat.py
Scott Shawcroft fab634e3ee Turn on Rosie CI testing to test new builds on real hardware.
This introduces a skip_if module that can be used by tests to
determine when they should be skipped due to the environment.

Some tests have been split in order to have finer grained skip
control.
2017-08-11 17:16:13 -07:00

21 lines
428 B
Python

import skip_if
skip_if.no_cpython_compat()
try:
try:
from collections import namedtuple
except ImportError:
from ucollections import namedtuple
except ImportError:
skip_if.skip()
# Try single string
T3 = namedtuple("TupComma", "foo bar")
t = T3(1, 2)
print(t.foo, t.bar)
# Try single string with comma field separator
# Not implemented so far
#T2 = namedtuple("TupComma", "foo,bar")
#t = T2(1, 2)