示例#1
0
 def test_validate_tuple_format(self):
     with self.assertRaises(ValueError):
         xso.normalize_tag(("foo",))
     with self.assertRaises(ValueError):
         xso.normalize_tag(("foo", "bar", "baz"))
     with self.assertRaises(ValueError):
         xso.normalize_tag(("foo", None))
     with self.assertRaises(ValueError):
         xso.normalize_tag((None, None))
     with self.assertRaises(TypeError):
         xso.normalize_tag((1, 2))
示例#2
0
 def test_validate_tuple_format(self):
     with self.assertRaises(ValueError):
         xso.normalize_tag(("foo",))
     with self.assertRaises(ValueError):
         xso.normalize_tag(("foo", "bar", "baz"))
     with self.assertRaises(ValueError):
         xso.normalize_tag(("foo", None))
     with self.assertRaises(ValueError):
         xso.normalize_tag((None, None))
     with self.assertRaises(TypeError):
         xso.normalize_tag((1, 2))
示例#3
0
 def test_reject_incorrect_types(self):
     with self.assertRaises(TypeError):
         xso.normalize_tag(1)
     with self.assertRaises(TypeError):
         xso.normalize_tag((1, 2))
示例#4
0
 def test_validate_etree_format(self):
     with self.assertRaises(ValueError):
         xso.normalize_tag("uri:bar}foo")
示例#5
0
 def test_etree_format(self):
     self.assertEqual(
         ("uri:bar", "foo"),
         xso.normalize_tag("{uri:bar}foo")
     )
示例#6
0
 def test_with_namespace(self):
     self.assertEqual(
         ("uri:bar", "foo"),
         xso.normalize_tag(("uri:bar", "foo"))
     )
示例#7
0
 def test_unqualified(self):
     self.assertEqual(
         (None, "foo"),
         xso.normalize_tag("foo")
     )
示例#8
0
 def test_reject_incorrect_types(self):
     with self.assertRaises(TypeError):
         xso.normalize_tag(1)
     with self.assertRaises(TypeError):
         xso.normalize_tag((1, 2))
示例#9
0
 def test_validate_etree_format(self):
     with self.assertRaises(ValueError):
         xso.normalize_tag("uri:bar}foo")
示例#10
0
 def test_etree_format(self):
     self.assertEqual(("uri:bar", "foo"), xso.normalize_tag("{uri:bar}foo"))
示例#11
0
 def test_with_namespace(self):
     self.assertEqual(("uri:bar", "foo"), xso.normalize_tag(("uri:bar", "foo")))
示例#12
0
 def test_unqualified(self):
     self.assertEqual((None, "foo"), xso.normalize_tag("foo"))