def test_get_no_attribute(self): field = AttributeValueField() value = field.get_value(self.pq) self.assertIsNone(value)
def test_get_attribute_no_selector(self): pq = self.pq.find('p') field = AttributeValueField(attr='id') value = field.get_value(pq) self.assertEqual(value, "p_id")
def test_get_invalid_attribute(self): field = AttributeValueField(selector="p", attr='href') value = field.get_value(self.pq) self.assertIsNone(value)
def test_get_attribute(self): field = AttributeValueField(selector=".link", attr='href') value = field.get_value(self.pq) self.assertEqual(value, "http://github.com/matiasb")