def test_object_id_field_type_requires_kwargs_as_dict(self): object_id_tuple_bad_kwargs = (models.TextField, 10) self.assertRaises( TypeError, lambda: instantiate_object_id_field(object_id_tuple_bad_kwargs))
def test_object_id_field_type_tuple(self): field = instantiate_object_id_field((models.CharField, { 'max_length': 20 })) self.assertIsInstance(field, models.CharField) self.assertEqual(field.max_length, 20)
def test_object_id_field_type_requires_field_class(self): self.assertRaises(TypeError, lambda: instantiate_object_id_field(int))
def test_object_id_field_type_class(self): field = instantiate_object_id_field(models.PositiveIntegerField) self.assertIsInstance(field, models.PositiveIntegerField)