Beispiel #1
0
 def test_to_string_leaf(self):
     n = BinaryNode(BinaryNodeRef(), "k", ValueRef(address=999), BinaryNodeRef(), 1)
     pickled = BinaryNodeRef.referent_to_string(n)
     d = pickle.loads(pickled)
     eq_(d["left"], 0)
     eq_(d["key"], "k")
     eq_(d["value"], 999)
     eq_(d["right"], 0)
Beispiel #2
0
 def test_to_string_leaf(self):
     n = BinaryNode(BinaryNodeRef(), 'k', ValueRef(address=999),
                    BinaryNodeRef(), 1)
     pickled = BinaryNodeRef.referent_to_string(n)
     d = pickle.loads(pickled)
     eq_(d['left'], 0)
     eq_(d['key'], 'k')
     eq_(d['value'], 999)
     eq_(d['right'], 0)
Beispiel #3
0
 def test_to_string_nonleaf(self):
     left_ref = BinaryNodeRef(address=123)
     right_ref = BinaryNodeRef(address=321)
     n = BinaryNode(left_ref, 'k', ValueRef(address=999), right_ref, 3)
     pickled = BinaryNodeRef.referent_to_string(n)
     d = pickle.loads(pickled)
     eq_(d['left'], 123)
     eq_(d['key'], 'k')
     eq_(d['value'], 999)
     eq_(d['right'], 321)
Beispiel #4
0
 def test_to_string_nonleaf(self):
     left_ref = BinaryNodeRef(address=123)
     right_ref = BinaryNodeRef(address=321)
     n = BinaryNode(left_ref, "k", ValueRef(address=999), right_ref, 3)
     pickled = BinaryNodeRef.referent_to_string(n)
     d = pickle.loads(pickled)
     eq_(d["left"], 123)
     eq_(d["key"], "k")
     eq_(d["value"], 999)
     eq_(d["right"], 321)
Beispiel #5
0
 def test_to_string_leaf(self):
     n = BinaryNode(BinaryNodeRef(), 'k', ValueRef(address=999), BinaryNodeRef(), 1)
     pickled = BinaryNodeRef.referent_to_string(n)
     d = pickle.loads(pickled)
     eq_(d['left'], 0)
     eq_(d['key'], 'k')
     eq_(d['value'], 999)
     eq_(d['right'], 0)
Beispiel #6
0
 def test_to_string_nonleaf(self):
     left_ref = BinaryNodeRef(address=123)
     right_ref = BinaryNodeRef(address=321)
     n = BinaryNode(left_ref, 'k', ValueRef(address=999), right_ref, 3)
     pickled = BinaryNodeRef.referent_to_string(n)
     d = pickle.loads(pickled)
     eq_(d['left'], 123)
     eq_(d['key'], 'k')
     eq_(d['value'], 999)
     eq_(d['right'], 321)