def test_has_id(self): element = Element("foo", attrib={'id': '1'}) self.assertTrue(has_id(element)) element = Element("foo", attrib={'id': 'bar'}) self.assertTrue(has_id(element))
def test_no_id(self): element = Element("foo") self.assertFalse(has_id(element))
def test_empty_id(self): element = Element("foo", attrib={'id': ''}) self.assertFalse(has_id(element)) element = Element("foo", attrib={'id': ' '}) self.assertFalse(has_id(element))
def test_none(self): self.assertFalse(has_id(None))