[Python-checkins] r73092 - sandbox/trunk/2to3/lib2to3/tests/test_pytree.py

benjamin.peterson python-checkins at python.org
Mon Jun 1 04:00:51 CEST 2009


Author: benjamin.peterson
Date: Mon Jun 1 04:00:51 2009
New Revision: 73092
Log:
change hideous java naming scheme
Modified:
 sandbox/trunk/2to3/lib2to3/tests/test_pytree.py
Modified: sandbox/trunk/2to3/lib2to3/tests/test_pytree.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/tests/test_pytree.py	(original)
+++ sandbox/trunk/2to3/lib2to3/tests/test_pytree.py	Mon Jun 1 04:00:51 2009
@@ -44,34 +44,34 @@
 self.assertEqual(str(w[1].message), "set_prefix() is deprecated; " \
 "use the prefix property")
 
- def testBaseCantConstruct(self):
+ def test_instantiate_base(self):
 if __debug__:
 # Test that instantiating Base() raises an AssertionError
 self.assertRaises(AssertionError, pytree.Base)
 
- def testLeaf(self):
+ def test_leaf(self):
 l1 = pytree.Leaf(100, "foo")
 self.assertEqual(l1.type, 100)
 self.assertEqual(l1.value, "foo")
 
- def testLeafRepr(self):
+ def test_leaf_repr(self):
 l1 = pytree.Leaf(100, "foo")
 self.assertEqual(repr(l1), "Leaf(100, 'foo')")
 
- def testLeafStr(self):
+ def test_leaf_str(self):
 l1 = pytree.Leaf(100, "foo")
 self.assertEqual(str(l1), "foo")
 l2 = pytree.Leaf(100, "foo", context=(" ", (10, 1)))
 self.assertEqual(str(l2), " foo")
 
- def testLeafStrNumericValue(self):
+ def test_leaf_str_numeric_value(self):
 # Make sure that the Leaf's value is stringified. Failing to
 # do this can cause a TypeError in certain situations.
 l1 = pytree.Leaf(2, 5)
 l1.prefix = "foo_"
 self.assertEqual(str(l1), "foo_5")
 
- def testLeafEq(self):
+ def test_leaf_equality(self):
 l1 = pytree.Leaf(100, "foo")
 l2 = pytree.Leaf(100, "foo", context=(" ", (1, 0)))
 self.assertEqual(l1, l2)
@@ -80,7 +80,7 @@
 self.assertNotEqual(l1, l3)
 self.assertNotEqual(l1, l4)
 
- def testLeafPrefix(self):
+ def test_leaf_prefix(self):
 l1 = pytree.Leaf(100, "foo")
 self.assertEqual(l1.prefix, "")
 self.failIf(l1.was_changed)
@@ -88,27 +88,27 @@
 self.assertEqual(l1.prefix, " ##\n\n")
 self.failUnless(l1.was_changed)
 
- def testNode(self):
+ def test_node(self):
 l1 = pytree.Leaf(100, "foo")
 l2 = pytree.Leaf(200, "bar")
 n1 = pytree.Node(1000, [l1, l2])
 self.assertEqual(n1.type, 1000)
 self.assertEqual(n1.children, [l1, l2])
 
- def testNodeRepr(self):
+ def test_node_repr(self):
 l1 = pytree.Leaf(100, "foo")
 l2 = pytree.Leaf(100, "bar", context=(" ", (1, 0)))
 n1 = pytree.Node(1000, [l1, l2])
 self.assertEqual(repr(n1),
 "Node(1000, [%s, %s])" % (repr(l1), repr(l2)))
 
- def testNodeStr(self):
+ def test_node_str(self):
 l1 = pytree.Leaf(100, "foo")
 l2 = pytree.Leaf(100, "bar", context=(" ", (1, 0)))
 n1 = pytree.Node(1000, [l1, l2])
 self.assertEqual(str(n1), "foo bar")
 
- def testNodePrefix(self):
+ def test_node_prefix(self):
 l1 = pytree.Leaf(100, "foo")
 self.assertEqual(l1.prefix, "")
 n1 = pytree.Node(1000, [l1])
@@ -117,7 +117,7 @@
 self.assertEqual(n1.prefix, " ")
 self.assertEqual(l1.prefix, " ")
 
- def testGetSuffix(self):
+ def test_get_suffix(self):
 l1 = pytree.Leaf(100, "foo", prefix="a")
 l2 = pytree.Leaf(100, "bar", prefix="b")
 n1 = pytree.Node(1000, [l1, l2])
@@ -133,14 +133,14 @@
 self.assertEqual(l3.get_suffix(), "")
 self.assertEqual(n2.get_suffix(), "")
 
- def testNodeEq(self):
+ def test_node_equality(self):
 n1 = pytree.Node(1000, ())
 n2 = pytree.Node(1000, [], context=(" ", (1, 0)))
 self.assertEqual(n1, n2)
 n3 = pytree.Node(1001, ())
 self.assertNotEqual(n1, n3)
 
- def testNodeEqRecursive(self):
+ def test_node_recursive_equality(self):
 l1 = pytree.Leaf(100, "foo")
 l2 = pytree.Leaf(100, "foo")
 n1 = pytree.Node(1000, [l1])
@@ -150,7 +150,7 @@
 n3 = pytree.Node(1000, [l3])
 self.assertNotEqual(n1, n3)
 
- def testReplace(self):
+ def test_replace(self):
 l1 = pytree.Leaf(100, "foo")
 l2 = pytree.Leaf(100, "+")
 l3 = pytree.Leaf(100, "bar")
@@ -164,7 +164,7 @@
 self.failUnless(isinstance(n1.children, list))
 self.failUnless(n1.was_changed)
 
- def testReplaceWithList(self):
+ def test_replace_with_list(self):
 l1 = pytree.Leaf(100, "foo")
 l2 = pytree.Leaf(100, "+")
 l3 = pytree.Leaf(100, "bar")
@@ -174,26 +174,26 @@
 self.assertEqual(str(n1), "foo**bar")
 self.failUnless(isinstance(n1.children, list))
 
- def testPostOrder(self):
+ def test_post_order(self):
 l1 = pytree.Leaf(100, "foo")
 l2 = pytree.Leaf(100, "bar")
 n1 = pytree.Node(1000, [l1, l2])
 self.assertEqual(list(n1.post_order()), [l1, l2, n1])
 
- def testPreOrder(self):
+ def test_pre_order(self):
 l1 = pytree.Leaf(100, "foo")
 l2 = pytree.Leaf(100, "bar")
 n1 = pytree.Node(1000, [l1, l2])
 self.assertEqual(list(n1.pre_order()), [n1, l1, l2])
 
- def testChangedLeaf(self):
+ def test_changed_leaf(self):
 l1 = pytree.Leaf(100, "f")
 self.failIf(l1.was_changed)
 
 l1.changed()
 self.failUnless(l1.was_changed)
 
- def testChangedNode(self):
+ def test_changed_node(self):
 l1 = pytree.Leaf(100, "f")
 n1 = pytree.Node(1000, [l1])
 self.failIf(n1.was_changed)
@@ -201,7 +201,7 @@
 n1.changed()
 self.failUnless(n1.was_changed)
 
- def testChangedRecursive(self):
+ def test_changed_recursive(self):
 l1 = pytree.Leaf(100, "foo")
 l2 = pytree.Leaf(100, "+")
 l3 = pytree.Leaf(100, "bar")
@@ -216,13 +216,13 @@
 self.failUnless(n2.was_changed)
 self.failIf(l1.was_changed)
 
- def testLeafConstructorPrefix(self):
+ def test_leaf_constructor_prefix(self):
 for prefix in ("xyz_", ""):
 l1 = pytree.Leaf(100, "self", prefix=prefix)
 self.failUnless(str(l1), prefix + "self")
 self.assertEqual(l1.prefix, prefix)
 
- def testNodeConstructorPrefix(self):
+ def test_node_constructor_prefix(self):
 for prefix in ("xyz_", ""):
 l1 = pytree.Leaf(100, "self")
 l2 = pytree.Leaf(100, "foo", prefix="_")
@@ -232,7 +232,7 @@
 self.assertEqual(l1.prefix, prefix)
 self.assertEqual(l2.prefix, "_")
 
- def testRemove(self):
+ def test_remove(self):
 l1 = pytree.Leaf(100, "foo")
 l2 = pytree.Leaf(100, "foo")
 n1 = pytree.Node(1000, [l1, l2])
@@ -255,7 +255,7 @@
 self.failUnless(n1.was_changed)
 self.failUnless(n2.was_changed)
 
- def testRemoveParentless(self):
+ def test_remove_parentless(self):
 n1 = pytree.Node(1000, [])
 n1.remove()
 self.assertEqual(n1.parent, None)
@@ -264,7 +264,7 @@
 l1.remove()
 self.assertEqual(l1.parent, None)
 
- def testNodeSetChild(self):
+ def test_node_set_child(self):
 l1 = pytree.Leaf(100, "foo")
 n1 = pytree.Node(1000, [l1])
 
@@ -285,7 +285,7 @@
 # I don't care what it raises, so long as it's an exception
 self.assertRaises(Exception, n1.set_child, 0, list)
 
- def testNodeInsertChild(self):
+ def test_node_insert_child(self):
 l1 = pytree.Leaf(100, "foo")
 n1 = pytree.Node(1000, [l1])
 
@@ -301,7 +301,7 @@
 # I don't care what it raises, so long as it's an exception
 self.assertRaises(Exception, n1.insert_child, 0, list)
 
- def testNodeAppendChild(self):
+ def test_node_append_child(self):
 n1 = pytree.Node(1000, [])
 
 l1 = pytree.Leaf(100, "foo")
@@ -317,7 +317,7 @@
 # I don't care what it raises, so long as it's an exception
 self.assertRaises(Exception, n1.append_child, list)
 
- def testNodeNextSibling(self):
+ def test_node_next_sibling(self):
 n1 = pytree.Node(1000, [])
 n2 = pytree.Node(1000, [])
 p1 = pytree.Node(1000, [n1, n2])
@@ -326,7 +326,7 @@
 self.assertEqual(n2.next_sibling, None)
 self.assertEqual(p1.next_sibling, None)
 
- def testLeafNextSibling(self):
+ def test_leaf_next_sibling(self):
 l1 = pytree.Leaf(100, "a")
 l2 = pytree.Leaf(100, "b")
 p1 = pytree.Node(1000, [l1, l2])
@@ -335,7 +335,7 @@
 self.assertEqual(l2.next_sibling, None)
 self.assertEqual(p1.next_sibling, None)
 
- def testNodePrevSibling(self):
+ def test_node_prev_sibling(self):
 n1 = pytree.Node(1000, [])
 n2 = pytree.Node(1000, [])
 p1 = pytree.Node(1000, [n1, n2])
@@ -344,7 +344,7 @@
 self.assertEqual(n1.prev_sibling, None)
 self.assertEqual(p1.prev_sibling, None)
 
- def testLeafPrevSibling(self):
+ def test_leaf_prev_sibling(self):
 l1 = pytree.Leaf(100, "a")
 l2 = pytree.Leaf(100, "b")
 p1 = pytree.Node(1000, [l1, l2])
@@ -358,7 +358,7 @@
 
 """Unit tests for tree matching patterns."""
 
- def testBasicPatterns(self):
+ def test_basic_patterns(self):
 # Build a tree
 l1 = pytree.Leaf(100, "foo")
 l2 = pytree.Leaf(100, "bar")
@@ -394,7 +394,7 @@
 self.assertFalse(pn.match(l2, results=r))
 self.assertEqual(r, {})
 
- def testWildcardPatterns(self):
+ def test_wildcard(self):
 # Build a tree for testing
 l1 = pytree.Leaf(100, "foo")
 l2 = pytree.Leaf(100, "bar")
@@ -425,7 +425,7 @@
 self.assert_(r["pl"] is l3)
 r = {}
 
- def testGenerateMatches(self):
+ def test_generate_matches(self):
 la = pytree.Leaf(1, "a")
 lb = pytree.Leaf(1, "b")
 lc = pytree.Leaf(1, "c")
@@ -455,7 +455,7 @@
 for c in "abcdef":
 self.assertEqual(r["p" + c], pytree.Leaf(1, c))
 
- def testHasKeyExample(self):
+ def test_has_key_example(self):
 pattern = pytree.NodePattern(331,
 (pytree.LeafPattern(7),
 pytree.WildcardPattern(name="args"),


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /