示例#1
0
class TestEntryNode(unittest.TestCase):
    def setUp(self):
        self.node = EntryNode("key", "value")
        self.callback_call_count = 0

    def testEq(self):
        self.assertEqual(self.node, EntryNode("key", "value"))

    def testNe(self):
        self.assertNotEqual(self.node, EntryNode("k", "v"))

    def testWalk(self):
        self.node.walk(self.callback)
        self.assertEqual(self.callback_call_count, 1)

    def callback(self, node):
        self.callback_call_count += 1
示例#2
0
 def setUp(self):
     self.node = EntryNode("key", "value")
     self.callback_call_count = 0