diff options
author | Jason Kirtland <jek@discorporate.us> | 2008-01-19 23:37:11 +0000 |
---|---|---|
committer | Jason Kirtland <jek@discorporate.us> | 2008-01-19 23:37:11 +0000 |
commit | 4be99db15b7a62b37493c86da07bcc787f44a7df (patch) | |
tree | b9d71342f22e307a08c38487d63c795039f10b96 /test/testlib/compat.py | |
parent | 21193cebe22f44982cb70ecd64743df63494b17d (diff) | |
download | sqlalchemy-4be99db15b7a62b37493c86da07bcc787f44a7df.tar.gz |
- Restored 2.3 compat. in lib/sqlalchemy
- Part one of test suite fixes to run on 2.3
Lots of failures still around sets; sets.Set differs from __builtin__.set
particularly in the binops. We depend on set extensively now and may need to
provide a corrected sets.Set subclass on 2.3.
Diffstat (limited to 'test/testlib/compat.py')
-rw-r--r-- | test/testlib/compat.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/testlib/compat.py b/test/testlib/compat.py new file mode 100644 index 000000000..590bf50f4 --- /dev/null +++ b/test/testlib/compat.py @@ -0,0 +1,22 @@ +import new + +__all__ = 'set', 'sorted', '_function_named' + +try: + set = set +except NameError: + from sets import Set as set + +try: + sorted = sorted +except NameError: + def sorted(iterable): + return list(iterable).sort() + +def _function_named(fn, newname): + try: + fn.__name__ = newname + except: + fn = new.function(fn.func_code, fn.func_globals, newname, + fn.func_defaults, fn.func_closure) + return fn |