diff --git a/tests/schema/tests.py b/tests/schema/tests.py
index f6b80b9..fc2c568 100644
a
|
b
|
class SchemaTests(TransactionTestCase):
|
426 | 426 | with connection.schema_editor() as editor: |
427 | 427 | editor.alter_field(Note, old_field, new_field, strict=True) |
428 | 428 | |
| 429 | def test_alter_field_keep_null_status(self): |
| 430 | """ |
| 431 | Changing a field type shouldn't affect the not null status. |
| 432 | """ |
| 433 | with connection.schema_editor() as editor: |
| 434 | editor.create_model(Note) |
| 435 | with self.assertRaises(IntegrityError): |
| 436 | Note.objects.create(info=None) |
| 437 | old_field = Note._meta.get_field("info") |
| 438 | new_field = CharField(max_length=50) |
| 439 | new_field.set_attributes_from_name("info") |
| 440 | with connection.schema_editor() as editor: |
| 441 | editor.alter_field(Note, old_field, new_field, strict=True) |
| 442 | with self.assertRaises(IntegrityError): |
| 443 | Note.objects.create(info=None) |
| 444 | |
429 | 445 | def test_alter_null_to_not_null(self): |
430 | 446 | """ |
431 | 447 | #23609 - Tests handling of default values when altering from NULL to NOT NULL. |