summaryrefslogtreecommitdiff
path: root/tests/schema
diff options
context:
space:
mode:
Diffstat (limited to 'tests/schema')
-rw-r--r--tests/schema/tests.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py
index e1e3c7d3c6..5488013bfc 100644
--- a/tests/schema/tests.py
+++ b/tests/schema/tests.py
@@ -850,6 +850,23 @@ class SchemaTests(TransactionTestCase):
@isolate_apps("schema")
@skipUnlessDBFeature("supports_stored_generated_columns")
+ def test_add_generated_field_with_string_value(self):
+ class GeneratedFieldStringValueModel(Model):
+ value = GeneratedField(expression=Value("static string"), db_persist=True)
+
+ class Meta:
+ app_label = "schema"
+
+ with CaptureQueriesContext(connection) as ctx:
+ with connection.schema_editor() as editor:
+ editor.create_model(GeneratedFieldStringValueModel)
+ self.assertIs(
+ any("None" in query["sql"] for query in ctx.captured_queries),
+ False,
+ )
+
+ @isolate_apps("schema")
+ @skipUnlessDBFeature("supports_stored_generated_columns")
def test_add_generated_field_with_output_field(self):
class GeneratedFieldOutputFieldModel(Model):
price = DecimalField(max_digits=7, decimal_places=2)