diff options
author | Hasan Ramezani <hasan.r67@gmail.com> | 2019-07-30 15:18:12 +0200 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-07-30 16:32:13 +0200 |
commit | b2aad9ad4d35ee3bb448ba698b8c56bb972bdd8a (patch) | |
tree | 8beb4ca3ca2190ab37dadc9c2c7858d63adeaacd /tests/backends | |
parent | 421c4cd2eea4cf3ee0236e3dd3fc3567c54a380a (diff) | |
download | django-b2aad9ad4d35ee3bb448ba698b8c56bb972bdd8a.tar.gz |
Refs #30593 -- Added _parse_constraint_columns() hook to introspection on MariaDB.
Diffstat (limited to 'tests/backends')
-rw-r--r-- | tests/backends/mysql/test_introspection.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/backends/mysql/test_introspection.py b/tests/backends/mysql/test_introspection.py new file mode 100644 index 0000000000..1b8fb94ed9 --- /dev/null +++ b/tests/backends/mysql/test_introspection.py @@ -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) |