Beispiel #1
0
 def test_getPrefix_with_none(self):
     """
     Tests NamespaceMap.getPrefix with None. Should return generated prefix.
     """
     ns_map = NamespaceMap()
     result = ns_map.getPrefix(None)
     self.assertEqual(result, 'ns0')
Beispiel #2
0
 def test_getPrefix_with_none_with_prefix(self):
     """
     Tests NamespaceMap.getPrefix with None. Should return specified prefix.
     """
     ns_map = NamespaceMap()
     prefix = 'prefix'
     result = ns_map.getPrefix(None, prefix)
     self.assertEqual(result, prefix)
 def test_getPrefix_with_namespace(self):
     """
     Tests NamespaceMap.getPrefix with None. Should default namespace.
     """
     ns_map = NamespaceMap()
     namespace = 'namespace'
     result = ns_map.getPrefix(namespace)
     self.assertEqual(result, 'ns0')
Beispiel #4
0
 def test_getPrefix_with_namespace(self):
     """
     Tests NamespaceMap.getPrefix for 'namespace'. Should return generated
     prefix.
     """
     ns_map = NamespaceMap()
     namespace = 'namespace'
     result = ns_map.getPrefix(namespace)
     self.assertEqual(result, 'ns0')
 def test_getPrefix_with_namespace_with_prefix(self):
     """
     Tests NamespaceMap.getPrefix with None. Should return prefix.
     """
     ns_map = NamespaceMap()
     namespace = 'namespace'
     prefix = 'prefix'
     result = ns_map.getPrefix(namespace, prefix)
     self.assertEqual(result, prefix)
 def test_getPrefix_subsequent_call_with_namespace(self):
     """
     Tests NamespaceMap.getPrefix with None. Should return default namespace.
     """
     ns_map = NamespaceMap()
     namespace = 'namespace'
     result = ns_map.getPrefix(namespace)
     self.assertEqual(result, 'ns0')
     result_2 = ns_map.getPrefix(namespace)
     self.assertEqual(result_2, 'ns0')
Beispiel #7
0
 def test_getPrefix_subsequent_call_with_namespace(self):
     """
     Tests NamespaceMap.getPrefix twice with 'namespace'. Should return same
     generated prefix.
     """
     ns_map = NamespaceMap()
     namespace = 'namespace'
     result = ns_map.getPrefix(namespace)
     self.assertEqual(result, 'ns0')
     result_2 = ns_map.getPrefix(namespace)
     self.assertEqual(result_2, 'ns0')
 def test_getPrefix_subsequent_call_with_namespace_and_prefix(self):
     """
     Tests NamespaceMap.getPrefix with None. Should return default namespaces.
     """
     ns_map = NamespaceMap()
     namespace_1 = 'namespace_1'
     namespace_2 = 'namespace_2'
     result = ns_map.getPrefix(namespace_1)
     self.assertEqual(result, 'ns0')
     result_2 = ns_map.getPrefix(namespace_2)
     self.assertEqual(result_2, 'ns1')
Beispiel #9
0
 def test_getPrefix_subsequent_call_with_namespace_and_prefix(self):
     """
     Tests NamespaceMap.getPrefix twice with 'namespace' and specified
     prefix. Should return same specified prefix.
     """
     ns_map = NamespaceMap()
     namespace = 'namespace'
     prefix = 'prefix'
     result = ns_map.getPrefix(namespace, prefix)
     self.assertEqual(result, prefix)
     result_2 = ns_map.getPrefix(namespace, prefix)
     self.assertEqual(result_2, prefix)