diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2008-04-10 02:48:01 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2008-04-10 02:48:01 (GMT) |
commit | 60a819d681d1004a9703b050501b70912f40b1ed (patch) | |
tree | c7f8b66797ba0df84f074c71e437d574137dc775 /Lib/lib2to3/tests/test_pytree.py | |
parent | c00eb73a309d5e9a4e89c3114b32eda88bd83e98 (diff) | |
download | cpython-60a819d681d1004a9703b050501b70912f40b1ed.zip cpython-60a819d681d1004a9703b050501b70912f40b1ed.tar.gz cpython-60a819d681d1004a9703b050501b70912f40b1ed.tar.bz2 |
Merged revisions 62080-62262 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r62092 | collin.winter | 2008-04-01 18:27:10 +0200 (Di, 01 Apr 2008) | 1 line
Add get_prev_sibling() to complement pytree's get_next_sibling().
........
r62226 | collin.winter | 2008-04-08 21:07:56 +0200 (Di, 08 Apr 2008) | 1 line
Add min() and max() to the list of special contexts that don't require adding list() calls around dict methods.
........
r62232 | collin.winter | 2008-04-09 00:12:38 +0200 (Mi, 09 Apr 2008) | 4 lines
Fix for http://bugs.python.org/issue2596
This extends fix_xrange to know about the (mostly) same special contexts as fix_dict (where a special context is something that is guaranteed to fully consume the iterable), adding list() calls where appropriate. It also special-cases "x in range(y)".
........
Diffstat (limited to 'Lib/lib2to3/tests/test_pytree.py')
-rwxr-xr-x | Lib/lib2to3/tests/test_pytree.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/lib2to3/tests/test_pytree.py b/Lib/lib2to3/tests/test_pytree.py index 8876beb..57c8a82 100755 --- a/Lib/lib2to3/tests/test_pytree.py +++ b/Lib/lib2to3/tests/test_pytree.py @@ -319,6 +319,24 @@ class TestNodes(support.TestCase): self.assertEqual(l2.get_next_sibling(), None) self.assertEqual(p1.get_next_sibling(), None) + def testNodePrevSibling(self): + n1 = pytree.Node(1000, []) + n2 = pytree.Node(1000, []) + p1 = pytree.Node(1000, [n1, n2]) + + self.failUnless(n2.get_prev_sibling() is n1) + self.assertEqual(n1.get_prev_sibling(), None) + self.assertEqual(p1.get_prev_sibling(), None) + + def testLeafPrevSibling(self): + l1 = pytree.Leaf(100, "a") + l2 = pytree.Leaf(100, "b") + p1 = pytree.Node(1000, [l1, l2]) + + self.failUnless(l2.get_prev_sibling() is l1) + self.assertEqual(l1.get_prev_sibling(), None) + self.assertEqual(p1.get_prev_sibling(), None) + class TestPatterns(support.TestCase): |