diff options
author | Raymond Hettinger <python@rcn.com> | 2013-05-18 07:05:20 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2013-05-18 07:05:20 (GMT) |
commit | 163e9821b4644113e5aa4314e3c2e5b1b394e5f7 (patch) | |
tree | 877ab459b55549f50933947181f30598cc64edea /Lib | |
parent | 4e0172fd9acf7c5e8f30905fc997f904adbe562f (diff) | |
download | cpython-163e9821b4644113e5aa4314e3c2e5b1b394e5f7.zip cpython-163e9821b4644113e5aa4314e3c2e5b1b394e5f7.tar.gz cpython-163e9821b4644113e5aa4314e3c2e5b1b394e5f7.tar.bz2 |
Undo the deprecation of _asdict().
Backed out changeset c4ca39bece9d
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/collections/__init__.py | 3 | ||||
-rw-r--r-- | Lib/test/test_collections.py | 7 |
2 files changed, 2 insertions, 8 deletions
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index 24daa34..5fd54e8 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -280,9 +280,6 @@ class {typename}(tuple): '''Return a new OrderedDict which maps field names to their values. This method is obsolete. Use vars(nt) or nt.__dict__ instead. ''' - import warnings - warnings.warn('_asdict() is deprecated. Use vars(nt) instead.', - DeprecationWarning, stacklevel=2) return self.__dict__ def __getnewargs__(self): diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 12bd952..8033031 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -217,11 +217,8 @@ 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.__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() + self.assertEqual(p._asdict(), dict(x=11, y=22)) # test _asdict method + self.assertEqual(vars(p), p._asdict()) # verify that vars() works try: p._replace(x=1, error=2) |