Commits

Gustavo Picon committed 5b26c53

test that exposes a couple of hard to find bugs in sorted MP and sorted AL

Comments (0)

Files changed (1)

treebeard/tests.py

                     (4, 1, u'fgh', 1, 0)]
         self.assertEqual(self.got(), expected)
 
-    def _multi_add_child_sorted(self):
+    def _multi_add_child_root_sorted(self):
         root = self.sorted_model.add_root(val1=0, val2=0, desc='aaa')
         root.add_child(val1=3, val2=3, desc='zxy')
         root.add_child(val1=1, val2=4, desc='bcd')
                     (4, 1, u'fgh', 2, 0)]
         self.assertEqual(self.got(), expected)
 
+    def _multi_add_child_nonroot_sorted(self):
+        root = self.sorted_model.add_root(val1=0, val2=0, desc='aaa')
+        node = root.add_child(val1=3, val2=3, desc='zxy')
+        root.add_child(val1=1, val2=4, desc='bcd')
+        root.add_child(val1=2, val2=5, desc='zxy')
+        node.add_child(val1=3, val2=3, desc='abc')
+        node.add_child(val1=4, val2=1, desc='fgh')
+        expected = [(0, 0, u'aaa', 1, 3),
+                    (1, 4, u'bcd', 2, 2),
+                    (3, 3, u'abc', 3, 0),
+                    (4, 1, u'fgh', 3, 0),
+                    (2, 5, u'zxy', 2, 0),
+                    (3, 3, u'zxy', 2, 0)]
+        self.assertEqual(self.got(), expected)
+
     def _multi_move_sorted(self):
         self.sorted_model.add_root(val1=3, val2=3, desc='zxy')
         self.sorted_model.add_root(val1=1, val2=4, desc='bcd')