Tests binary fields get a sane default (#22851)
(self)
| 888 | self.assertTrue(columns["note_id"][1][6]) |
| 889 | |
| 890 | def test_add_field_binary(self): |
| 891 | """ |
| 892 | Tests binary fields get a sane default (#22851) |
| 893 | """ |
| 894 | # Create the table |
| 895 | with connection.schema_editor() as editor: |
| 896 | editor.create_model(Author) |
| 897 | # Add the new field |
| 898 | new_field = BinaryField(blank=True) |
| 899 | new_field.set_attributes_from_name("bits") |
| 900 | with connection.schema_editor() as editor: |
| 901 | editor.add_field(Author, new_field) |
| 902 | columns = self.column_classes(Author) |
| 903 | # MySQL annoyingly uses the same backend, so it'll come back as one of |
| 904 | # these two types. |
| 905 | self.assertIn(columns["bits"][0], ("BinaryField", "TextField")) |
| 906 | |
| 907 | def test_add_field_durationfield_with_default(self): |
| 908 | with connection.schema_editor() as editor: |
nothing calls this directly
no test coverage detected