mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #28792 -- Fixed index name truncation of namespaced tables.
Refs #27458, #27843. Thanks Tim and Mariusz for the review.
This commit is contained in:
parent
532a4f22ad
commit
ee85ef8315
5 changed files with 53 additions and 13 deletions
|
@ -2,7 +2,9 @@
|
|||
from decimal import Decimal, Rounded
|
||||
|
||||
from django.db import connection
|
||||
from django.db.backends.utils import format_number, truncate_name
|
||||
from django.db.backends.utils import (
|
||||
format_number, split_identifier, truncate_name,
|
||||
)
|
||||
from django.db.utils import NotSupportedError
|
||||
from django.test import (
|
||||
SimpleTestCase, TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature,
|
||||
|
@ -21,6 +23,12 @@ class TestUtils(SimpleTestCase):
|
|||
self.assertEqual(truncate_name('username"."some_long_table', 10), 'username"."some_la38a')
|
||||
self.assertEqual(truncate_name('username"."some_long_table', 10, 3), 'username"."some_loa38')
|
||||
|
||||
def test_split_identifier(self):
|
||||
self.assertEqual(split_identifier('some_table'), ('', 'some_table'))
|
||||
self.assertEqual(split_identifier('"some_table"'), ('', 'some_table'))
|
||||
self.assertEqual(split_identifier('namespace"."some_table'), ('namespace', 'some_table'))
|
||||
self.assertEqual(split_identifier('"namespace"."some_table"'), ('namespace', 'some_table'))
|
||||
|
||||
def test_format_number(self):
|
||||
def equal(value, max_d, places, result):
|
||||
self.assertEqual(format_number(Decimal(value), max_d, places), result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue