示例#1
0
    def test_invalid_choice(self):
        with self.assertRaises(ValidationError):
            FakeModel(tz=INVALID_TZ)

        with self.assertRaises(ValidationError):
            FakeModel(tz=4)

        with self.assertRaises(ValidationError):
            FakeModel(tz=object())
示例#2
0
 def test_invalid_blank_none(self):
     m = FakeModel(tz=None)
     self.assertRaises(ValidationError, m.full_clean)
示例#3
0
 def test_valid_default_values_without_saving_to_db(self):
     m = FakeModel(tz=UTC_tz)
     m.full_clean()
     self.assertEqual(m.tz_opt, None)
     self.assertEqual(m.tz_opt_default, PST_tz)