diff options
author | Gord Thompson <gord@gordthompson.com> | 2021-08-12 13:04:28 -0600 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-09-30 10:10:16 -0400 |
commit | 257f9130c321aaa948690d0e49c7352ad1188abd (patch) | |
tree | 2648c88460c3e5de847ee998edb7a6df0aa9b261 /test/dialect/postgresql/test_compiler.py | |
parent | f7f2df607301afcd11dd49a2ccb632291de12d29 (diff) | |
download | sqlalchemy-257f9130c321aaa948690d0e49c7352ad1188abd.tar.gz |
Modernize tests - calling_mapper_directly
a few changes for py2k:
* map_imperatively() includes the check that a class
is being sent, this was only working for mapper() before
* the test suite didn't place the py2k "autouse" workaround
in the correct order, seemingly, tried to adjust the
per-test ordering setup in pytestplugin.py
Change-Id: I4cc39630724e810953cfda7b2afdadc8b948e3c2
Diffstat (limited to 'test/dialect/postgresql/test_compiler.py')
-rw-r--r-- | test/dialect/postgresql/test_compiler.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py index 0b56d8987..5ada6f592 100644 --- a/test/dialect/postgresql/test_compiler.py +++ b/test/dialect/postgresql/test_compiler.py @@ -41,7 +41,7 @@ from sqlalchemy.dialects.postgresql import TSRANGE from sqlalchemy.dialects.postgresql.base import PGDialect from sqlalchemy.dialects.postgresql.psycopg2 import PGDialect_psycopg2 from sqlalchemy.orm import aliased -from sqlalchemy.orm import mapper +from sqlalchemy.orm import clear_mappers from sqlalchemy.orm import Session from sqlalchemy.sql import column from sqlalchemy.sql import literal_column @@ -2728,7 +2728,7 @@ class InsertOnConflictTest(fixtures.TestBase, AssertsCompiledSQL): ) -class DistinctOnTest(fixtures.TestBase, AssertsCompiledSQL): +class DistinctOnTest(fixtures.MappedTest, AssertsCompiledSQL): """Test 'DISTINCT' with SQL expression language and orm.Query with an emphasis on PG's 'DISTINCT ON' syntax. @@ -2825,7 +2825,8 @@ class DistinctOnTest(fixtures.TestBase, AssertsCompiledSQL): class Foo(object): pass - mapper(Foo, self.table) + clear_mappers() + self.mapper_registry.map_imperatively(Foo, self.table) sess = Session() subq = sess.query(Foo).subquery() @@ -2842,7 +2843,7 @@ class DistinctOnTest(fixtures.TestBase, AssertsCompiledSQL): class Foo(object): pass - mapper(Foo, self.table) + self.mapper_registry.map_imperatively(Foo, self.table) a1 = aliased(Foo) sess = Session() self.assert_compile( |