Пример #1
0
 def test_clean_none_value(self):
     field = TextField()
     self.assertIsNone(field.clean(None))
Пример #2
0
 def test_clean_value(self):
     field = TextField()
     self.assertEqual(field.clean("   Hello world. "), "Hello world.")
Пример #3
0
 def test_using_selector_with_eq(self):
     field = TextField(selector=".link:eq(1)")
     value = field.get_value(self.pq)
     self.assertEqual(value, "Another link.")
Пример #4
0
 def test_not_found(self):
     field = TextField(selector=".not-found")
     value = field.get_value(self.pq)
     self.assertIsNone(value)
Пример #5
0
 def test_no_selector(self):
     field = TextField()
     value = field.get_value(self.pq)
     self.assertEqual(value, "Some text. Link text. Another link.")
Пример #6
0
 def test_using_selector(self):
     field = TextField(selector=".link")
     value = field.get_value(self.pq)
     self.assertEqual(value, "Link text.")
Пример #7
0
 def test_clean_none_value(self):
     field = TextField()
     self.assertIsNone(field.clean(None))
Пример #8
0
 def test_clean_value(self):
     field = TextField()
     self.assertEqual(field.clean("   Hello world. "), "Hello world.")
Пример #9
0
 def test_not_found(self):
     field = TextField(selector=".not-found")
     value = field.get_value(self.pq)
     self.assertIsNone(value)
Пример #10
0
 def test_using_selector_with_eq(self):
     field = TextField(selector=".link:eq(1)")
     value = field.get_value(self.pq)
     self.assertEqual(value, "Another link.")
Пример #11
0
 def test_using_selector(self):
     field = TextField(selector=".link")
     value = field.get_value(self.pq)
     self.assertEqual(value, "Link text.")
Пример #12
0
 def test_no_selector(self):
     field = TextField()
     value = field.get_value(self.pq)
     self.assertEqual(value, "Some text. Link text. Another link.")
Пример #13
0
 def test_coerce_value(self):
     field = TextField(coerce=int)
     self.assertEqual(field.coerce("5"), 5)