diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/basics/class_store_class.py | 2 | ||||
| -rw-r--r-- | tests/basics/namedtuple1.py | 19 | ||||
| -rw-r--r-- | tests/bench/var-8-namedtuple-1st.py | 2 | ||||
| -rw-r--r-- | tests/bench/var-8.1-namedtuple-5th.py | 2 |
4 files changed, 12 insertions, 13 deletions
diff --git a/tests/basics/class_store_class.py b/tests/basics/class_store_class.py index 60f65220d..09a8e8bc4 100644 --- a/tests/basics/class_store_class.py +++ b/tests/basics/class_store_class.py @@ -7,7 +7,7 @@ try: except ImportError: from _collections import namedtuple -_DefragResultBase = namedtuple('DefragResult', 'foo bar') +_DefragResultBase = namedtuple('DefragResult', [ 'foo', 'bar' ]) class _ResultMixinStr(object): def encode(self): diff --git a/tests/basics/namedtuple1.py b/tests/basics/namedtuple1.py index 05dd15bd1..a94b7e7ab 100644 --- a/tests/basics/namedtuple1.py +++ b/tests/basics/namedtuple1.py @@ -3,7 +3,7 @@ try: except ImportError: from _collections import namedtuple -T = namedtuple("Tup", "foo bar") +T = namedtuple("Tup", ["foo", "bar"]) # CPython prints fully qualified name, what we don't bother to do so far #print(T) t = T(1, 2) @@ -27,7 +27,7 @@ except TypeError: try: t.bar = 200 except AttributeError: - print("AttribiteError") + print("AttributeError") try: t = T(1) @@ -39,13 +39,12 @@ try: except TypeError: print("TypeError") -# Try comma field separator -T2 = namedtuple("TupComma", "foo,bar") -t = T2(1, 2) -print(t) -print(t.foo, t.bar) - -# Try list of fields +# Try single string # Not implemented so far -#T3 = namedtuple("TupComma", ["foo", "bar"]) +#T3 = namedtuple("TupComma", "foo bar") #t = T3(1, 2) + +# Try single string with comma field seperator +# Not implemented so far +#T2 = namedtuple("TupComma", "foo,bar") +#t = T2(1, 2) diff --git a/tests/bench/var-8-namedtuple-1st.py b/tests/bench/var-8-namedtuple-1st.py index 7c4099ac6..f3f36f415 100644 --- a/tests/bench/var-8-namedtuple-1st.py +++ b/tests/bench/var-8-namedtuple-1st.py @@ -1,7 +1,7 @@ import bench from _collections import namedtuple -T = namedtuple("Tup", "num bar") +T = namedtuple("Tup", ["num", "bar"]) def test(num): t = T(20000000, 0) diff --git a/tests/bench/var-8.1-namedtuple-5th.py b/tests/bench/var-8.1-namedtuple-5th.py index 2cd6d15a0..b6bdc8d79 100644 --- a/tests/bench/var-8.1-namedtuple-5th.py +++ b/tests/bench/var-8.1-namedtuple-5th.py @@ -1,7 +1,7 @@ import bench from _collections import namedtuple -T = namedtuple("Tup", "foo1 foo2 foo3 foo4 num") +T = namedtuple("Tup", ["foo1", "foo2", "foo3", "foo4", "num"]) def test(num): t = T(0, 0, 0, 0, 20000000) |
