MCPcopy
hub / github.com/django/django / test_add_field_o2o_nullable

Method test_add_field_o2o_nullable

tests/schema/tests.py:878–888  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

876 self.assertEqual(Author.objects.extra(where=["thing = 1"]).count(), 2)
877
878 def test_add_field_o2o_nullable(self):
879 with connection.schema_editor() as editor:
880 editor.create_model(Author)
881 editor.create_model(Note)
882 new_field = OneToOneField(Note, CASCADE, null=True)
883 new_field.set_attributes_from_name("note")
884 with connection.schema_editor() as editor:
885 editor.add_field(Author, new_field)
886 columns = self.column_classes(Author)
887 self.assertIn("note_id", columns)
888 self.assertTrue(columns["note_id"][1][6])
889
890 def test_add_field_binary(self):
891 """

Callers

nothing calls this directly

Calls 6

column_classesMethod · 0.95
OneToOneFieldClass · 0.90
schema_editorMethod · 0.80
create_modelMethod · 0.45
add_fieldMethod · 0.45

Tested by

no test coverage detected