mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #18843 -- Replaced more special chars in column names (inspectdb)
Thanks airstrike for the report.
This commit is contained in:
@@ -59,8 +59,10 @@ class InspectDBTestCase(TestCase):
|
||||
self.assertNotIn(" 45extra = models.CharField", output, msg=error_message)
|
||||
self.assertIn("number_45extra = models.CharField", output)
|
||||
|
||||
def test_underscores_column_name_introspection(self):
|
||||
"""Introspection of column names containing underscores (#12460)"""
|
||||
def test_special_column_name_introspection(self):
|
||||
"""Introspection of column names containing special characters,
|
||||
unsuitable for Python identifiers
|
||||
"""
|
||||
out = StringIO()
|
||||
call_command('inspectdb', stdout=out)
|
||||
output = out.getvalue()
|
||||
@@ -68,3 +70,4 @@ class InspectDBTestCase(TestCase):
|
||||
self.assertIn("field_field = models.IntegerField(db_column='Field_')", output)
|
||||
self.assertIn("field_field_0 = models.IntegerField(db_column='Field__')", output)
|
||||
self.assertIn("field_field_1 = models.IntegerField(db_column='__field')", output)
|
||||
self.assertIn("prc_x = models.IntegerField(db_column='prc(%) x')", output)
|
||||
|
||||
Reference in New Issue
Block a user