diff options
author | Jason Kirtland <jek@discorporate.us> | 2008-07-15 19:23:52 +0000 |
---|---|---|
committer | Jason Kirtland <jek@discorporate.us> | 2008-07-15 19:23:52 +0000 |
commit | 8fa48edbf9d84093152aced94fc1eb7996b9827f (patch) | |
tree | 6ceb46f942f1a3b7f8994ba202fd5b02c21ec7c7 /test/testlib/compat.py | |
parent | 6917ffb9bdae19a368abef5fdbd4655fc27fcdf2 (diff) | |
download | sqlalchemy-8fa48edbf9d84093152aced94fc1eb7996b9827f.tar.gz |
- Removed 2.3 set emulations/enhancements.
(sets.Set-based collections & DB-API returns still work.)
Diffstat (limited to 'test/testlib/compat.py')
-rw-r--r-- | test/testlib/compat.py | 89 |
1 files changed, 1 insertions, 88 deletions
diff --git a/test/testlib/compat.py b/test/testlib/compat.py index fcb7fa1e9..0b157e64a 100644 --- a/test/testlib/compat.py +++ b/test/testlib/compat.py @@ -1,94 +1,7 @@ import new -__all__ = 'set', 'frozenset', 'sorted', '_function_named', 'deque', 'reversed' +__all__ = '_function_named', -try: - set = set -except NameError: - import sets - - # keep this in sync with sqlalchemy.util.Set - # can't just import it in testlib because of coverage, load order, etc. - class set(sets.Set): - def _binary_sanity_check(self, other): - pass - - def issubset(self, iterable): - other = type(self)(iterable) - return sets.Set.issubset(self, other) - def __le__(self, other): - sets.Set._binary_sanity_check(self, other) - return sets.Set.__le__(self, other) - def issuperset(self, iterable): - other = type(self)(iterable) - return sets.Set.issuperset(self, other) - def __ge__(self, other): - sets.Set._binary_sanity_check(self, other) - return sets.Set.__ge__(self, other) - - # lt and gt still require a BaseSet - def __lt__(self, other): - sets.Set._binary_sanity_check(self, other) - return sets.Set.__lt__(self, other) - def __gt__(self, other): - sets.Set._binary_sanity_check(self, other) - return sets.Set.__gt__(self, other) - - def __ior__(self, other): - if not isinstance(other, sets.BaseSet): - return NotImplemented - return sets.Set.__ior__(self, other) - def __iand__(self, other): - if not isinstance(other, sets.BaseSet): - return NotImplemented - return sets.Set.__iand__(self, other) - def __ixor__(self, other): - if not isinstance(other, sets.BaseSet): - return NotImplemented - return sets.Set.__ixor__(self, other) - def __isub__(self, other): - if not isinstance(other, sets.BaseSet): - return NotImplemented - return sets.Set.__isub__(self, other) - -try: - frozenset = frozenset -except NameError: - import sets - from sets import ImmutableSet as frozenset - -try: - sorted = sorted -except NameError: - def sorted(iterable, cmp=None): - l = list(iterable) - if cmp: - l.sort(cmp) - else: - l.sort() - return l - -try: - reversed = reversed -except NameError: - def reversed(seq): - i = len(seq) - 1 - while i >= 0: - yield seq[i] - i -= 1 - raise StopIteration() - -try: - from collections import deque -except ImportError: - class deque(list): - def appendleft(self, x): - self.insert(0, x) - def popleft(self): - return self.pop(0) - def extendleft(self, iterable): - for x in reversed(list(iterable)): - self.insert(0, x) def _function_named(fn, newname): try: |