tests/queries/test_sqlcompiler.py
raw| 1 | from django.db import DEFAULT_DB_ALIAS, connection |
| 2 | from django.db.models.sql import Query |
| 3 | from django.test import SimpleTestCase |
| 4 | |
| 5 | from .models import Item |
| 6 | |
| 7 | |
| 8 | class SQLCompilerTest(SimpleTestCase): |
| 9 | def test_repr(self): |
| 10 | query = Query(Item) |
| 11 | compiler = query.get_compiler(DEFAULT_DB_ALIAS, connection) |
| 12 | self.assertEqual( |
| 13 | repr(compiler), |
| 14 | f"<SQLCompiler model=Item connection=" |
| 15 | f"<DatabaseWrapper vendor={connection.vendor!r} alias='default'> " |
| 16 | f"using='default'>", |
| 17 | ) |