def test_python_tree(self): """ Test that django-mptt builds the tree correctly. version 0.4.2 has a bug when populating the tree, it incorrectly grafts the Child1 and Child2 nodes under the N2 node. """ self.assertEqual( { "name": u"Root", "id": 1, "children": [{ "name": u"N1", "id": 2, "children": [{ "name": u"Child1", "id": 4, "children": [] }, { "name": u"Child2", "id": 5, "children": [] }] }, { "name": u"N2", "id": 3, "children": [] }] }, generate_tree())
def test_python_tree(self): """ Test that django-mptt builds the tree correctly. version 0.4.2 has a bug when populating the tree, it incorrectly grafts the Child1 and Child2 nodes under the N2 node. """ self.assertEqual( { "name": u"Root", "id": 1, "children": [ { "name": u"N1", "id": 2, "children": [ { "name": u"Child1", "id": 4, "children": [] }, { "name": u"Child2", "id": 5, "children": [] } ] }, { "name": u"N2", "id": 3, "children": [] } ] }, generate_tree() )
def test_python_tree(self): """Data structure generation shouldn't explode when tree is empty.""" self.assertEqual({}, generate_tree())