summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2013-05-18 00:14:27 (GMT)
committerRaymond Hettinger <python@rcn.com>2013-05-18 00:14:27 (GMT)
commit4e0172fd9acf7c5e8f30905fc997f904adbe562f (patch)
tree4b3d9a89af022af0b132a00e73d41fb24a63f36d /Lib/test/test_collections.py
parent8c03d832b33e02b575b78d53406a3f1ee2706f8d (diff)
downloadcpython-4e0172fd9acf7c5e8f30905fc997f904adbe562f.zip
cpython-4e0172fd9acf7c5e8f30905fc997f904adbe562f.tar.gz
cpython-4e0172fd9acf7c5e8f30905fc997f904adbe562f.tar.bz2
Deprecate nametuple._asdict()
Diffstat (limited to 'Lib/test/test_collections.py')
-rw-r--r--Lib/test/test_collections.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 8033031..12bd952 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -217,8 +217,11 @@ class TestNamedTuple(unittest.TestCase):
self.assertEqual(p, Point._make([11, 22])) # test _make classmethod
self.assertEqual(p._fields, ('x', 'y')) # test _fields attribute
self.assertEqual(p._replace(x=1), (1, 22)) # test _replace method
- self.assertEqual(p._asdict(), dict(x=11, y=22)) # test _asdict method
- self.assertEqual(vars(p), p._asdict()) # verify that vars() works
+ self.assertEqual(p.__dict__,
+ OrderedDict([('x', 11), ('y', 22)])) # test __dict__ attribute
+ self.assertEqual(vars(p), p.__dict__) # verify that vars() works
+ with self.assertWarns(DeprecationWarning): # check deprecate of _asdict
+ p._asdict()
try:
p._replace(x=1, error=2)