MCPcopy
hub / github.com/django/django / test_add_db_comment_generated_field

Method test_add_db_comment_generated_field

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

Source from the content-addressed store, hash-verified

5011
5012 @skipUnlessDBFeature("supports_comments", "supports_stored_generated_columns")
5013 def test_add_db_comment_generated_field(self):
5014 comment = "Custom comment"
5015 field = GeneratedField(
5016 expression=Value(1),
5017 db_persist=True,
5018 output_field=IntegerField(),
5019 db_comment=comment,
5020 )
5021 field.set_attributes_from_name("volume")
5022 with connection.schema_editor() as editor:
5023 editor.create_model(Author)
5024 editor.add_field(Author, field)
5025 self.assertEqual(
5026 self.get_column_comment(Author._meta.db_table, "volume"),
5027 comment,
5028 )
5029
5030 @skipUnlessDBFeature("supports_comments")
5031 def test_add_db_comment_and_default_charfield(self):

Callers

nothing calls this directly

Calls 8

get_column_commentMethod · 0.95
GeneratedFieldClass · 0.90
ValueClass · 0.90
IntegerFieldClass · 0.90
schema_editorMethod · 0.80
create_modelMethod · 0.45
add_fieldMethod · 0.45

Tested by

no test coverage detected