1
0
mirror of https://github.com/django/django.git synced 2024-12-28 03:55:50 +00:00
django/tests/queries/test_sqlcompiler.py
2022-02-07 20:37:05 +01:00

18 lines
544 B
Python

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