def test_tree_node_illegal_adding(self): exception_thrown = False try: Node(self.entities[0]).add_child(Node(self.entities[1])) except InvalidChildException: exception_thrown = True self.assertTrue(exception_thrown)
def test_potential_new_children_2(self): node = Node( SystematicPoint(SystematicIdentifier("1.2", 1), "Description")) new_child_identifiers = self.service.get_potential_new_child_identifier( node) self.assertEqual(1, len(new_child_identifiers)) self.assertEqual(SystematicIdentifier("1.2", 1, 1), new_child_identifiers[0])
def test_potential_new_children_6(self): node = Node( SystematicPoint(SystematicIdentifier("1.2", 3), "Description")) self.systematic_dao.get_children.return_value = [ SystematicPoint(SystematicIdentifier("1.2", 3, 1), "Description") ] new_child_identifiers = self.service.get_potential_new_child_identifier( node) self.assertEqual(1, len(new_child_identifiers)) self.assertEqual(SystematicIdentifier("1.2", 3, 2), new_child_identifiers[0])
def test_potential_new_children_1(self): node = Node( SystematicPoint(SystematicIdentifier("1.2", 1, 2), "Description")) self.assertEqual( 0, len(self.service.get_potential_new_child_identifier(node)))
def test_find_by_id(self): self.assertEqual("String representation (2)", "%s" % Node(self.entities[0]))