예제 #1
0
 def test_get_no_attribute(self):
     field = AttributeValueField()
     value = field.get_value(self.pq)
     self.assertIsNone(value)
예제 #2
0
 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")
예제 #3
0
 def test_get_invalid_attribute(self):
     field = AttributeValueField(selector="p", attr='href')
     value = field.get_value(self.pq)
     self.assertIsNone(value)
예제 #4
0
 def test_get_attribute(self):
     field = AttributeValueField(selector=".link", attr='href')
     value = field.get_value(self.pq)
     self.assertEqual(value, "http://github.com/matiasb")
예제 #5
0
 def test_get_no_attribute(self):
     field = AttributeValueField()
     value = field.get_value(self.pq)
     self.assertIsNone(value)
예제 #6
0
 def test_get_invalid_attribute(self):
     field = AttributeValueField(selector="p", attr='href')
     value = field.get_value(self.pq)
     self.assertIsNone(value)
예제 #7
0
 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")
예제 #8
0
 def test_get_attribute(self):
     field = AttributeValueField(selector=".link", attr='href')
     value = field.get_value(self.pq)
     self.assertEqual(value, "http://github.com/matiasb")