summaryrefslogtreecommitdiff
path: root/tests/queries/test_sqlcompiler.py
diff options
context:
space:
mode:
authorJonny Park <jonnythebard9@gmail.com>2021-03-26 16:14:09 +0900
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-11-19 07:57:02 +0100
commit6fa2930573ff862a7f8ae8a11aa8bb7253fddeb7 (patch)
treeff653eb83f687bb48ed479c6ba5106ea59c0fec4 /tests/queries/test_sqlcompiler.py
parent5e218cc0b704ebf64c460050a97b5fafe63e92b0 (diff)
Refs #24121 -- Added __repr__() to BaseDatabaseWrapper, JoinPromoter, and SQLCompiler.
Diffstat (limited to 'tests/queries/test_sqlcompiler.py')
-rw-r--r--tests/queries/test_sqlcompiler.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/queries/test_sqlcompiler.py b/tests/queries/test_sqlcompiler.py
new file mode 100644
index 0000000000..3116429c05
--- /dev/null
+++ b/tests/queries/test_sqlcompiler.py
@@ -0,0 +1,17 @@
+from django.db import DEFAULT_DB_ALIAS, connection
+from django.db.models.sql import Query
+from django.test import SimpleTestCase
+
+from .models import Item
+
+
+class SQLCompilerTest(SimpleTestCase):
+ def test_repr(self):
+ query = Query(Item)
+ compiler = query.get_compiler(DEFAULT_DB_ALIAS, connection)
+ self.assertEqual(
+ repr(compiler),
+ f"<SQLCompiler model=Item connection="
+ f"<DatabaseWrapper vendor={connection.vendor!r} alias='default'> "
+ f"using='default'>"
+ )