diff options
Diffstat (limited to 'test/ext')
| -rw-r--r-- | test/ext/mypy/incremental/ticket_6435/enum_col_import2.py | 6 | ||||
| -rw-r--r-- | test/ext/test_associationproxy.py | 4 | ||||
| -rw-r--r-- | test/ext/test_automap.py | 4 | ||||
| -rw-r--r-- | test/ext/test_mutable.py | 57 | ||||
| -rw-r--r-- | test/ext/test_serializer.py | 17 |
5 files changed, 30 insertions, 58 deletions
diff --git a/test/ext/mypy/incremental/ticket_6435/enum_col_import2.py b/test/ext/mypy/incremental/ticket_6435/enum_col_import2.py index 4f29932e5..161dce087 100644 --- a/test/ext/mypy/incremental/ticket_6435/enum_col_import2.py +++ b/test/ext/mypy/incremental/ticket_6435/enum_col_import2.py @@ -1,8 +1,10 @@ from sqlalchemy import Column from sqlalchemy import Enum -from sqlalchemy.orm import declarative_base, Mapped +from sqlalchemy.orm import declarative_base +from sqlalchemy.orm import Mapped from . import enum_col_import1 -from .enum_col_import1 import IntEnum, StrEnum +from .enum_col_import1 import IntEnum +from .enum_col_import1 import StrEnum Base = declarative_base() diff --git a/test/ext/test_associationproxy.py b/test/ext/test_associationproxy.py index ae5e6c848..93da104de 100644 --- a/test/ext/test_associationproxy.py +++ b/test/ext/test_associationproxy.py @@ -1,5 +1,7 @@ import copy import pickle +from unittest.mock import call +from unittest.mock import Mock from sqlalchemy import cast from sqlalchemy import exc @@ -35,8 +37,6 @@ from sqlalchemy.testing import fixtures from sqlalchemy.testing import is_ from sqlalchemy.testing import is_false from sqlalchemy.testing.fixtures import fixture_session -from sqlalchemy.testing.mock import call -from sqlalchemy.testing.mock import Mock from sqlalchemy.testing.schema import Column from sqlalchemy.testing.schema import Table from sqlalchemy.testing.util import gc_collect diff --git a/test/ext/test_automap.py b/test/ext/test_automap.py index eaafa3477..625bb8da2 100644 --- a/test/ext/test_automap.py +++ b/test/ext/test_automap.py @@ -1,6 +1,8 @@ import random import threading import time +from unittest.mock import Mock +from unittest.mock import patch from sqlalchemy import create_engine from sqlalchemy import ForeignKey @@ -19,8 +21,6 @@ from sqlalchemy.orm import Session from sqlalchemy.testing import assert_raises_message from sqlalchemy.testing import fixtures from sqlalchemy.testing import is_ -from sqlalchemy.testing.mock import Mock -from sqlalchemy.testing.mock import patch from sqlalchemy.testing.schema import Column from sqlalchemy.testing.schema import Table from ..orm._fixtures import FixtureTest diff --git a/test/ext/test_mutable.py b/test/ext/test_mutable.py index 6545d4545..3370fa1b5 100644 --- a/test/ext/test_mutable.py +++ b/test/ext/test_mutable.py @@ -7,7 +7,6 @@ from sqlalchemy import func from sqlalchemy import Integer from sqlalchemy import String from sqlalchemy import testing -from sqlalchemy import util from sqlalchemy.ext.mutable import MutableComposite from sqlalchemy.ext.mutable import MutableDict from sqlalchemy.ext.mutable import MutableList @@ -573,44 +572,24 @@ class _MutableListTestBase(_MutableListTestFixture): # print(repr(pickles)) # return - if util.py3k: - pickles = [ - b"\x80\x04\x95<\x00\x00\x00\x00\x00\x00\x00\x8c\x16" - b"sqlalchemy.ext.mutable\x94\x8c\x0bMutableList\x94\x93\x94)" - b"\x81\x94(K\x01K\x02e]\x94(K\x01K\x02eb.", - b"ccopy_reg\n_reconstructor\np0\n(csqlalchemy.ext.mutable\n" - b"MutableList\np1\nc__builtin__\nlist\np2\n(lp3\nI1\naI2\n" - b"atp4\nRp5\n(lp6\nI1\naI2\nab.", - b"ccopy_reg\n_reconstructor\nq\x00(csqlalchemy.ext.mutable\n" - b"MutableList\nq\x01c__builtin__\nlist\nq\x02]q\x03(K\x01K" - b"\x02etq\x04Rq\x05]q\x06(K\x01K\x02eb.", - b"\x80\x02csqlalchemy.ext.mutable\nMutableList\nq\x00)\x81q" - b"\x01(K\x01K\x02e]q\x02(K\x01K\x02eb.", - b"\x80\x03csqlalchemy.ext.mutable\nMutableList\nq\x00)\x81q" - b"\x01(K\x01K\x02e]q\x02(K\x01K\x02eb.", - b"\x80\x04\x95<\x00\x00\x00\x00\x00\x00\x00\x8c\x16" - b"sqlalchemy.ext.mutable\x94\x8c\x0bMutableList\x94\x93\x94)" - b"\x81\x94(K\x01K\x02e]\x94(K\x01K\x02eb.", - ] - else: - pickles = [ - "\x80\x02csqlalchemy.ext.mutable\nMutableList\nq\x00]q\x01" - "(K\x01K\x02e\x85q\x02Rq\x03.", - "\x80\x02csqlalchemy.ext.mutable\nMutableList" - "\nq\x00]q\x01(K\x01K\x02e\x85q\x02Rq\x03.", - "csqlalchemy.ext.mutable\nMutableList\np0\n" - "((lp1\nI1\naI2\natp2\nRp3\n.", - "csqlalchemy.ext.mutable\nMutableList\nq\x00(]" - "q\x01(K\x01K\x02etq\x02Rq\x03.", - "\x80\x02csqlalchemy.ext.mutable\nMutableList" - "\nq\x01]q\x02(K\x01K\x02e\x85Rq\x03.", - "\x80\x02csqlalchemy.ext.mutable\nMutableList\n" - "q\x01]q\x02(K\x01K\x02e\x85Rq\x03.", - "csqlalchemy.ext.mutable\nMutableList\np1\n" - "((lp2\nI1\naI2\natRp3\n.", - "csqlalchemy.ext.mutable\nMutableList\nq\x01" - "(]q\x02(K\x01K\x02etRq\x03.", - ] + pickles = [ + b"\x80\x04\x95<\x00\x00\x00\x00\x00\x00\x00\x8c\x16" + b"sqlalchemy.ext.mutable\x94\x8c\x0bMutableList\x94\x93\x94)" + b"\x81\x94(K\x01K\x02e]\x94(K\x01K\x02eb.", + b"ccopy_reg\n_reconstructor\np0\n(csqlalchemy.ext.mutable\n" + b"MutableList\np1\nc__builtin__\nlist\np2\n(lp3\nI1\naI2\n" + b"atp4\nRp5\n(lp6\nI1\naI2\nab.", + b"ccopy_reg\n_reconstructor\nq\x00(csqlalchemy.ext.mutable\n" + b"MutableList\nq\x01c__builtin__\nlist\nq\x02]q\x03(K\x01K" + b"\x02etq\x04Rq\x05]q\x06(K\x01K\x02eb.", + b"\x80\x02csqlalchemy.ext.mutable\nMutableList\nq\x00)\x81q" + b"\x01(K\x01K\x02e]q\x02(K\x01K\x02eb.", + b"\x80\x03csqlalchemy.ext.mutable\nMutableList\nq\x00)\x81q" + b"\x01(K\x01K\x02e]q\x02(K\x01K\x02eb.", + b"\x80\x04\x95<\x00\x00\x00\x00\x00\x00\x00\x8c\x16" + b"sqlalchemy.ext.mutable\x94\x8c\x0bMutableList\x94\x93\x94)" + b"\x81\x94(K\x01K\x02e]\x94(K\x01K\x02eb.", + ] for pickle_ in pickles: obj = pickle.loads(pickle_) diff --git a/test/ext/test_serializer.py b/test/ext/test_serializer.py index 03ad96b3c..9a05e1fae 100644 --- a/test/ext/test_serializer.py +++ b/test/ext/test_serializer.py @@ -24,7 +24,6 @@ from sqlalchemy.testing import eq_ from sqlalchemy.testing import fixtures from sqlalchemy.testing.schema import Column from sqlalchemy.testing.schema import Table -from sqlalchemy.util import ue def pickle_protocols(): @@ -195,7 +194,6 @@ class SerializeTest(AssertsCompiledSQL, fixtures.MappedTest): ], ) - @testing.requires.non_broken_pickle def test_query_two(self): q = ( Session.query(User) @@ -206,7 +204,6 @@ class SerializeTest(AssertsCompiledSQL, fixtures.MappedTest): eq_(q2.all(), [User(name="fred")]) eq_(list(q2.with_entities(User.id, User.name)), [(9, "fred")]) - @testing.requires.non_broken_pickle def test_query_three(self): ua = aliased(User) q = ( @@ -233,7 +230,6 @@ class SerializeTest(AssertsCompiledSQL, fixtures.MappedTest): pickled_failing = serializer.dumps(j, prot) serializer.loads(pickled_failing, users.metadata, None) - @testing.requires.non_broken_pickle def test_orm_join(self): from sqlalchemy.orm.util import join @@ -264,7 +260,6 @@ class SerializeTest(AssertsCompiledSQL, fixtures.MappedTest): [(u7, u8), (u7, u9), (u7, u10), (u8, u9), (u8, u10)], ) - @testing.requires.non_broken_pickle def test_any(self): r = User.addresses.any(Address.email == "x") ser = serializer.dumps(r, -1) @@ -273,20 +268,16 @@ class SerializeTest(AssertsCompiledSQL, fixtures.MappedTest): def test_unicode(self): m = MetaData() - t = Table( - ue("\u6e2c\u8a66"), m, Column(ue("\u6e2c\u8a66_id"), Integer) - ) + t = Table("\u6e2c\u8a66", m, Column("\u6e2c\u8a66_id", Integer)) - expr = select(t).where(t.c[ue("\u6e2c\u8a66_id")] == 5) + expr = select(t).where(t.c["\u6e2c\u8a66_id"] == 5) expr2 = serializer.loads(serializer.dumps(expr, -1), m) self.assert_compile( expr2, - ue( - 'SELECT "\u6e2c\u8a66"."\u6e2c\u8a66_id" FROM "\u6e2c\u8a66" ' - 'WHERE "\u6e2c\u8a66"."\u6e2c\u8a66_id" = :\u6e2c\u8a66_id_1' - ), + 'SELECT "\u6e2c\u8a66"."\u6e2c\u8a66_id" FROM "\u6e2c\u8a66" ' + 'WHERE "\u6e2c\u8a66"."\u6e2c\u8a66_id" = :\u6e2c\u8a66_id_1', dialect="default", ) |
