Пример #1
0
    def test__siblings(self):
        # Set up a basic template
        elem = xmlutil.TemplateElement('test')
        tmpl = xmlutil.Template(elem)

        # Check that we get the right siblings
        siblings = tmpl._siblings()
        self.assertEqual(len(siblings), 1)
        self.assertEqual(siblings[0], elem)
Пример #2
0
    def test__nsmap(self):
        # Set up a basic template
        elem = xmlutil.TemplateElement('test')
        tmpl = xmlutil.Template(elem, nsmap=dict(a="foo"))

        # Check out that we get the right namespace dictionary
        nsmap = tmpl._nsmap()
        self.assertNotEqual(id(nsmap), id(tmpl.nsmap))
        self.assertEqual(len(nsmap), 1)
        self.assertEqual(nsmap['a'], 'foo')
Пример #3
0
 def test_wrap(self):
     # These are strange methods, but they make things easier
     elem = xmlutil.TemplateElement('test')
     tmpl = xmlutil.Template(elem)
     self.assertEqual(tmpl.unwrap(), elem)
     self.assertEqual(tmpl.wrap(), tmpl)