diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-03-14 22:41:15 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-03-14 22:41:15 (GMT) |
commit | 1a5e5de818a1393bbb32fabf2ee8ad8c239b6e9b (patch) | |
tree | 8454695ee3e36f84927877129e84e0913221ccc3 /Lib | |
parent | 7c466b4fdcdf59f8d98abcbf62dbbf4ab209d2db (diff) | |
download | cpython-1a5e5de818a1393bbb32fabf2ee8ad8c239b6e9b.zip cpython-1a5e5de818a1393bbb32fabf2ee8ad8c239b6e9b.tar.gz cpython-1a5e5de818a1393bbb32fabf2ee8ad8c239b6e9b.tar.bz2 |
remove get_prefix and set_prefix (#13248)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/lib2to3/pytree.py | 20 | ||||
-rw-r--r-- | Lib/lib2to3/tests/test_pytree.py | 17 |
2 files changed, 0 insertions, 37 deletions
diff --git a/Lib/lib2to3/pytree.py b/Lib/lib2to3/pytree.py index fa4942f3..17cbf0a 100644 --- a/Lib/lib2to3/pytree.py +++ b/Lib/lib2to3/pytree.py @@ -109,26 +109,6 @@ class Base(object): """ raise NotImplementedError - def set_prefix(self, prefix): - """ - Set the prefix for the node (see Leaf class). - - DEPRECATED; use the prefix property directly. - """ - warnings.warn("set_prefix() is deprecated; use the prefix property", - DeprecationWarning, stacklevel=2) - self.prefix = prefix - - def get_prefix(self): - """ - Return the prefix for the node (see Leaf class). - - DEPRECATED; use the prefix property directly. - """ - warnings.warn("get_prefix() is deprecated; use the prefix property", - DeprecationWarning, stacklevel=2) - return self.prefix - def replace(self, new): """Replace this node with a new one in the parent.""" assert self.parent is not None, str(self) diff --git a/Lib/lib2to3/tests/test_pytree.py b/Lib/lib2to3/tests/test_pytree.py index ac7d900..a2ab1f3 100644 --- a/Lib/lib2to3/tests/test_pytree.py +++ b/Lib/lib2to3/tests/test_pytree.py @@ -31,23 +31,6 @@ class TestNodes(support.TestCase): """Unit tests for nodes (Base, Leaf, Node).""" - if sys.version_info >= (2,6): - # warnings.catch_warnings is new in 2.6. - def test_deprecated_prefix_methods(self): - l = pytree.Leaf(100, "foo") - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always", DeprecationWarning) - self.assertEqual(l.get_prefix(), "") - l.set_prefix("hi") - self.assertEqual(l.prefix, "hi") - self.assertEqual(len(w), 2) - for warning in w: - self.assertTrue(warning.category is DeprecationWarning) - self.assertEqual(str(w[0].message), "get_prefix() is deprecated; " \ - "use the prefix property") - self.assertEqual(str(w[1].message), "set_prefix() is deprecated; " \ - "use the prefix property") - def test_instantiate_base(self): if __debug__: # Test that instantiating Base() raises an AssertionError |