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())
def test_invalid_blank_none(self): m = FakeModel(tz=None) self.assertRaises(ValidationError, m.full_clean)
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)