summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorAntonin ENFRUN <antonin.e@me.com>2016-05-22 19:28:04 +0200
committerDamien George <damien.p.george@gmail.com>2016-05-23 21:08:07 +0100
commitca41dc27504c68e805472a6788c4cddbb0da28b1 (patch)
tree0ee2873c0724889b1232afb1e1316b39e30a5fbe /tests
parent2133924e4603e2d692f92e048798f0982dbbf793 (diff)
downloadmicropython-ca41dc27504c68e805472a6788c4cddbb0da28b1.tar.gz
micropython-ca41dc27504c68e805472a6788c4cddbb0da28b1.zip
py/objnamedtuple: Allow passing field names as a tuple.
So the documentation's example works. Besides, a tuple can be more memory efficient.
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/namedtuple1.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/basics/namedtuple1.py b/tests/basics/namedtuple1.py
index dfbb79f2eb..346e32fbfc 100644
--- a/tests/basics/namedtuple1.py
+++ b/tests/basics/namedtuple1.py
@@ -66,6 +66,11 @@ T3 = namedtuple("TupComma", "foo bar")
t = T3(1, 2)
print(t.foo, t.bar)
+# Try tuple
+T4 = namedtuple("TupTuple", ("foo", "bar"))
+t = T4(1, 2)
+print(t.foo, t.bar)
+
# Try single string with comma field seperator
# Not implemented so far
#T2 = namedtuple("TupComma", "foo,bar")