mirror of
https://github.com/django/django.git
synced 2025-07-24 05:36:15 +00:00
Refs #30593 -- Added _parse_constraint_columns() hook to introspection on MariaDB.
This commit is contained in:
parent
421c4cd2ee
commit
b2aad9ad4d
2 changed files with 32 additions and 7 deletions
22
tests/backends/mysql/test_introspection.py
Normal file
22
tests/backends/mysql/test_introspection.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
from unittest import skipUnless
|
||||
|
||||
from django.db import connection
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
@skipUnless(connection.vendor == 'mysql', 'MySQL tests')
|
||||
class ParsingTests(TestCase):
|
||||
def test_parse_constraint_columns(self):
|
||||
tests = (
|
||||
('`height` >= 0', ['height']),
|
||||
('`cost` BETWEEN 1 AND 10', ['cost']),
|
||||
('`ref1` > `ref2`', ['ref1', 'ref2']),
|
||||
(
|
||||
'`start` IS NULL OR `end` IS NULL OR `start` < `end`',
|
||||
['start', 'end'],
|
||||
),
|
||||
)
|
||||
for check_clause, expected_columns in tests:
|
||||
with self.subTest(check_clause):
|
||||
check_columns = connection.introspection._parse_constraint_columns(check_clause)
|
||||
self.assertEqual(list(check_columns), expected_columns)
|
Loading…
Add table
Add a link
Reference in a new issue