diff --git a/tests/test_orm.py b/tests/test_orm.py index 0dd22a0b..c540ad58 100644 --- a/tests/test_orm.py +++ b/tests/test_orm.py @@ -367,18 +367,29 @@ class Department(Base): .select_from(Employee) .outerjoin(sub) ) - # assert ( - # str(query.compile(engine_testaccount)).replace("\n", "") - # == "SELECT employees.employee_id, departments.department_id " - # "FROM departments, employees LEFT OUTER JOIN LATERAL " - # "(SELECT departments.department_id AS department_id, departments.name AS name " - # "FROM departments) AS anon_1" - # ) + compiled_stmts = ( + # v1.x + "SELECT employees.employee_id, departments.department_id " + "FROM departments, employees LEFT OUTER JOIN LATERAL " + "(SELECT departments.department_id AS department_id, departments.name AS name " + "FROM departments) AS anon_1", + # v2.x + "SELECT employees.employee_id, departments.department_id " + "FROM employees LEFT OUTER JOIN LATERAL " + "(SELECT departments.department_id AS department_id, departments.name AS name " + "FROM departments) AS anon_1, departments", + ) + compiled_stmt = str(query.compile(engine_testaccount)).replace("\n", "") + assert compiled_stmt in compiled_stmts + with caplog.at_level(logging.DEBUG): assert [res for res in session.execute(query)] assert ( "SELECT employees.employee_id, departments.department_id FROM departments" in caplog.text + ) or ( + "SELECT employees.employee_id, departments.department_id FROM employees" + in caplog.text )