Refs #24121 -- Added __repr__() to BaseDatabaseWrapper, JoinPromoter, and SQLCompiler.

This commit is contained in:
Jonny Park 2021-03-26 16:14:09 +09:00 committed by Mariusz Felisiak
parent 5e218cc0b7
commit 6fa2930573
6 changed files with 52 additions and 1 deletions

View file

@ -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'>"
)