]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Didnt think about <2.5. When will I learn.
authorMichael Trier <mtrier@gmail.com>
Sat, 4 Oct 2008 02:57:19 +0000 (02:57 +0000)
committerMichael Trier <mtrier@gmail.com>
Sat, 4 Oct 2008 02:57:19 +0000 (02:57 +0000)
test/sql/testtypes.py

index c8b9d7f394c644b799cf589797ff82b1d90c7967..a3d813d0fb4848ec3ce51a099e6f2660d8d90e3b 100644 (file)
@@ -797,6 +797,19 @@ class BooleanTest(TestBase, AssertsExecutionResults):
         print res2
         assert(res2==[(2, False)])
 
+try:
+    from functools import partial
+except:
+    def partial(func, *args, **keywords):
+        def newfunc(*fargs, **fkeywords):
+            newkeywords = keywords.copy()
+            newkeywords.update(fkeywords)
+            return func(*(args + fargs), **newkeywords)
+        newfunc.func = func
+        newfunc.args = args
+        newfunc.keywords = keywords
+        return newfunc
+
 class CallableTest(TestBase, AssertsExecutionResults):
     def setUpAll(self):
         global meta
@@ -806,7 +819,6 @@ class CallableTest(TestBase, AssertsExecutionResults):
         meta.drop_all()
 
     def test_callable_as_arg(self):
-        from functools import partial
         ucode = partial(Unicode, assert_unicode=None)
 
         thing_table = Table('thing', meta,
@@ -814,7 +826,6 @@ class CallableTest(TestBase, AssertsExecutionResults):
         )
 
     def test_callable_as_kwarg(self):
-        from functools import partial
         ucode = partial(Unicode, assert_unicode=None)
 
         thang_table = Table('thang', meta,