]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- repair remaining tests
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 20 Nov 2010 16:35:16 +0000 (11:35 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 20 Nov 2010 16:35:16 +0000 (11:35 -0500)
test/aaa_profiling/test_orm.py
test/aaa_profiling/test_pool.py
test/ext/test_declarative.py
test/orm/test_cascade.py

index 4f94be79c9426a4ae8f325c6e483f768988fba22..d7e7b8c00068a94d7cbc1dd8c3e89d1fe5bacab4 100644 (file)
@@ -53,7 +53,7 @@ class MergeTest(_base.MappedTest):
         # down from 185 on this this is a small slice of a usually
         # bigger operation so using a small variance
 
-        @profiling.function_call_count(93, variance=0.001,
+        @profiling.function_call_count(97, variance=0.001,
                 versions={'2.4': 67, '3': 96})
         def go():
             return sess2.merge(p1, load=False)
index f99af50656ccd916c0055d1dba527aa0741e4371..b34144feb0311e6983aa1e5ce8c91628396ed454 100644 (file)
@@ -40,7 +40,7 @@ class QueuePoolTest(TestBase, AssertsExecutionResults):
     def test_second_samethread_connect(self):
         conn = pool.connect()
 
-        @profiling.function_call_count(5, {'2.4': 3, '3.0':6, '3.1':6})
+        @profiling.function_call_count(6, {'2.4': 4, '3.0':7, '3.1':7})
         def go():
             return pool.connect()
         c2 = go()
index 7c8ab0016f650f2f706a75b538aefd74eb7f60c2..fe22a51fae0d6ecbb1a186ebe7fc4c92ab91cb96 100644 (file)
@@ -568,50 +568,36 @@ class DeclarativeTest(DeclarativeTestBase):
         eq_(sess.query(User).all(), [User(name='u1',
             addresses=[Address(email='one'), Address(email='two')])])
 
-    @testing.uses_deprecated()
-    def test_custom_mapper(self):
-
-        class MyExt(sa.orm.MapperExtension):
-
-            def create_instance(self):
-                return 'CHECK'
+    def test_custom_mapper_attribute(self):
 
         def mymapper(cls, tbl, **kwargs):
-            kwargs['extension'] = MyExt()
-            return sa.orm.mapper(cls, tbl, **kwargs)
-
-        from sqlalchemy.orm.mapper import Mapper
-
-        class MyMapper(Mapper):
+            m = sa.orm.mapper(cls, tbl, **kwargs)
+            m.CHECK = True
+            return m
 
-            def __init__(self, *args, **kwargs):
-                kwargs['extension'] = MyExt()
-                Mapper.__init__(self, *args, **kwargs)
+        base = decl.declarative_base()
 
-        from sqlalchemy.orm import scoping
-        ss = scoping.ScopedSession(create_session)
-        ss.extension = MyExt()
-        ss_mapper = ss.mapper
-        for mapperfunc in mymapper, MyMapper, ss_mapper:
-            base = decl.declarative_base()
+        class Foo(base):
+            __tablename__ = 'foo'
+            __mapper_cls__ = mymapper
+            id = Column(Integer, primary_key=True)
+        
+        eq_(Foo.__mapper__.CHECK, True)
 
-            class Foo(base):
+    def test_custom_mapper_argument(self):
 
-                __tablename__ = 'foo'
-                __mapper_cls__ = mapperfunc
-                id = Column(Integer, primary_key=True)
-
-            eq_(Foo.__mapper__.compile().extension.create_instance(),
-                'CHECK')
-            base = decl.declarative_base(mapper=mapperfunc)
+        def mymapper(cls, tbl, **kwargs):
+            m = sa.orm.mapper(cls, tbl, **kwargs)
+            m.CHECK = True
+            return m
 
-            class Foo(base):
+        base = decl.declarative_base(mapper=mymapper)
 
-                __tablename__ = 'foo'
-                id = Column(Integer, primary_key=True)
+        class Foo(base):
+            __tablename__ = 'foo'
+            id = Column(Integer, primary_key=True)
 
-            eq_(Foo.__mapper__.compile().extension.create_instance(),
-                'CHECK')
+        eq_(Foo.__mapper__.CHECK, True)
 
     @testing.emits_warning('Ignoring declarative-like tuple value of '
                            'attribute id')
index 75b9e22ec1c5ebeb2fadcda0144ad9c2a6224f1b..f7a22dad688e5cb2b41029e5db821166d5f6035e 100644 (file)
@@ -446,7 +446,7 @@ class M2OCascadeTest(_base.MappedTest):
 
         # the error condition relies upon
         # these things being true
-        assert User.foo.impl.active_history is False
+        assert User.foo.dispatch.active_history is False
         eq_(
             attributes.get_history(u1, 'foo'),
             ([None], (), [attributes.PASSIVE_NO_RESULT])