示例#1
0
 def test_hide_on_null(self):
     field = EmailField(required=False, on_null=HIDE_FIELD)
     self.assertRaises(IgnoreField, field.to_native)
     self.assertIsNone(field.to_python())
示例#2
0
 def test_default(self):
     field = EmailField(required=True, default='*****@*****.**')
     field.validate()
     self.assertEqual(field.to_python(), '*****@*****.**')
     self.assertEqual(field.to_native(), '*****@*****.**')
示例#3
0
 def test_set_value(self):
     field = EmailField(required=True)
     field.set_value('*****@*****.**')
     field.validate()
     self.assertEqual(field.to_python(), '*****@*****.**')
     self.assertEqual(field.to_native(), '*****@*****.**')
示例#4
0
 def test_hide_on_null(self):
     field = EmailField(required=False, on_null=HIDE_FIELD)
     self.assertRaises(IgnoreField, field.to_native)
     self.assertIsNone(field.to_python())
示例#5
0
 def test_default(self):
     field = EmailField(required=True, default='*****@*****.**')
     field.validate()
     self.assertEqual(field.to_python(), '*****@*****.**')
     self.assertEqual(field.to_native(), '*****@*****.**')
示例#6
0
 def test_set_value(self):
     field = EmailField(required=True)
     field.set_value('*****@*****.**')
     field.validate()
     self.assertEqual(field.to_python(), '*****@*****.**')
     self.assertEqual(field.to_native(), '*****@*****.**')