mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
remove get_prefix and set_prefix (#13248)
This commit is contained in:
parent
7c466b4fdc
commit
1a5e5de818
3 changed files with 2 additions and 37 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue