diff options
| author | stijn | 2017-11-06 12:21:53 +0100 |
|---|---|---|
| committer | Paul Sokolovsky | 2017-11-12 14:16:54 +0200 |
| commit | 79ed58f87b008ed1ad75c611686ca8bebfe2a817 (patch) | |
| tree | af11d8a624bf55ea5669e0e5219248635325ef26 /tests | |
| parent | cada971113e6db0cf9e0751e95dbe9217dd707b5 (diff) | |
py/objnamedtuple: Add _asdict function if OrderedDict is supported
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/basics/namedtuple_asdict.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/basics/namedtuple_asdict.py b/tests/basics/namedtuple_asdict.py new file mode 100644 index 000000000..c5681376f --- /dev/null +++ b/tests/basics/namedtuple_asdict.py @@ -0,0 +1,20 @@ +try: + try: + from collections import namedtuple + except ImportError: + from ucollections 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())) |
