Пример #1
0
 def test_addremove(self):
     self.assertEqual(self.map.length, 0)
     self.map.setNamedItem(self.attr)
     self.assertEqual(self.map.length, 1)
     self.assertEqual(self.map.getNamedItem('src').value, 'a')
     self.assertIsNone(self.map.getNamedItem('aaa'))
     self.map.removeNamedItem(Attr('aaa'))
     self.assertEqual(self.map.length, 1)
     self.map.removeNamedItem(Attr('src'))
     self.assertEqual(self.map.length, 0)
Пример #2
0
 def createAttribute(self, name: str) -> Attr:
     """Create Attribute object with ``name``."""
     return Attr(name)
Пример #3
0
 def test_boolean_attr(self):
     hidden = Attr('hidden')
     hidden.value = True
     self.assertEqual(hidden.html, 'hidden')
     hidden.value = False
     self.assertEqual(hidden.html, '')
Пример #4
0
 def setUp(self):
     self.map = NamedNodeMap(self)
     self.attr = Attr('src', value='a')
Пример #5
0
 def setUp(self):
     self.id = Attr('id')
     self.cls = Attr('class')
     self.src = Attr('src')