Gustavo Picon avatar 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')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.