def test_add_exactly_one_bad_input(self): ns = Namespace() nsid = '.two.nodes' with self.assertRaises(ValueError): new_node = ns.add_exactly_one(nsid) nsid = '.now.three.nodes' with self.assertRaises(ValueError): new_node = ns.add_exactly_one(nsid)
def test_add_root_node(self): ns = Namespace() with self.assertRaises(NamespaceCollisionError): ns.add_exactly_one('.')
def test_add_exactly_one_happy_path(self): ns = Namespace() nsid = '.one_new_node' new_node = ns.add_exactly_one(nsid) self.assertEqual(str(new_node.nsid), nsid)