コード例 #1
0
ファイル: test___init__.py プロジェクト: horazont/aioxmpp
 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
ファイル: test___init__.py プロジェクト: horazont/aioxmpp
 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
ファイル: test___init__.py プロジェクト: horazont/aioxmpp
 def test_validate_etree_format(self):
     with self.assertRaises(ValueError):
         xso.normalize_tag("uri:bar}foo")
コード例 #10
0
ファイル: test___init__.py プロジェクト: horazont/aioxmpp
 def test_etree_format(self):
     self.assertEqual(("uri:bar", "foo"), xso.normalize_tag("{uri:bar}foo"))
コード例 #11
0
ファイル: test___init__.py プロジェクト: horazont/aioxmpp
 def test_with_namespace(self):
     self.assertEqual(("uri:bar", "foo"), xso.normalize_tag(("uri:bar", "foo")))
コード例 #12
0
ファイル: test___init__.py プロジェクト: horazont/aioxmpp
 def test_unqualified(self):
     self.assertEqual((None, "foo"), xso.normalize_tag("foo"))