summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/base/dependency.py3
-rw-r--r--test/base/utils.py10
-rw-r--r--test/engine/reflection.py4
-rw-r--r--test/ext/declarative.py1
-rw-r--r--test/orm/_base.py2
-rw-r--r--test/orm/_fixtures.py1
-rw-r--r--test/orm/collection.py10
-rw-r--r--test/orm/generative.py1
-rw-r--r--test/orm/mapper.py1
-rw-r--r--test/orm/naturalpks.py1
-rw-r--r--test/orm/relationships.py1
-rw-r--r--test/orm/session.py1
-rw-r--r--test/orm/unitofwork.py1
-rw-r--r--test/sql/defaults.py1
-rw-r--r--test/sql/generative.py2
-rw-r--r--test/testlib/__init__.py4
-rw-r--r--test/testlib/compat.py89
-rw-r--r--test/testlib/engines.py3
-rw-r--r--test/testlib/fixtures.py1
-rw-r--r--test/testlib/orm.py1
-rw-r--r--test/testlib/profiling.py2
-rw-r--r--test/testlib/testing.py2
-rw-r--r--test/zblog/blog.py6
23 files changed, 19 insertions, 129 deletions
diff --git a/test/base/dependency.py b/test/base/dependency.py
index f891bc92e..1318ef528 100644
--- a/test/base/dependency.py
+++ b/test/base/dependency.py
@@ -1,6 +1,5 @@
import testenv; testenv.configure_for_tests()
import sqlalchemy.topological as topological
-from sqlalchemy import util
from testlib import TestBase
@@ -26,7 +25,7 @@ class DependencySortTest(TestBase):
if collection is None:
collection = []
- items = util.Set()
+ items = set()
def assert_unique(node):
for item in [i for i in node[1] or [node[0]]]:
assert item not in items
diff --git a/test/base/utils.py b/test/base/utils.py
index 8b44de84e..3ce956a16 100644
--- a/test/base/utils.py
+++ b/test/base/utils.py
@@ -3,7 +3,7 @@ import threading, unittest
from sqlalchemy import util, sql, exc
from testlib import TestBase
from testlib.testing import eq_, is_, ne_
-from testlib.compat import frozenset, set, sorted
+
class OrderedDictTest(TestBase):
def test_odict(self):
@@ -351,16 +351,14 @@ class DuckTypeCollectionTest(TestBase):
for type_ in (set,
sets.Set,
- util.Set,
SetLike,
ForcedSet):
- eq_(util.duck_type_collection(type_), util.Set)
+ eq_(util.duck_type_collection(type_), set)
instance = type_()
- eq_(util.duck_type_collection(instance), util.Set)
+ eq_(util.duck_type_collection(instance), set)
for type_ in (frozenset,
- sets.ImmutableSet,
- util.FrozenSet):
+ sets.ImmutableSet):
is_(util.duck_type_collection(type_), None)
instance = type_()
is_(util.duck_type_collection(instance), None)
diff --git a/test/engine/reflection.py b/test/engine/reflection.py
index 259733027..3f8d4fff7 100644
--- a/test/engine/reflection.py
+++ b/test/engine/reflection.py
@@ -3,7 +3,6 @@ import StringIO, unicodedata
import sqlalchemy as sa
from testlib.sa import MetaData, Table, Column
from testlib import TestBase, ComparesTables, testing, engines, sa as tsa
-from testlib.compat import set
metadata, users = None, None
@@ -588,12 +587,11 @@ class CreateDropTest(TestBase):
self.assertEqual( testing.db.has_table('items'), False )
def test_tablenames(self):
- from sqlalchemy.util import Set
metadata.create_all(bind=testing.db)
# we only check to see if all the explicitly created tables are there, rather than
# assertEqual -- the test db could have "extra" tables if there is a misconfigured
# template. (*cough* tsearch2 w/ the pg windows installer.)
- self.assert_(not Set(metadata.tables) - Set(testing.db.table_names()))
+ self.assert_(not set(metadata.tables) - set(testing.db.table_names()))
metadata.drop_all(bind=testing.db)
class SchemaManipulationTest(TestBase):
diff --git a/test/ext/declarative.py b/test/ext/declarative.py
index 21947b1e6..8ea3abd61 100644
--- a/test/ext/declarative.py
+++ b/test/ext/declarative.py
@@ -5,7 +5,6 @@ from testlib import sa, testing
from testlib.sa import MetaData, Table, Column, Integer, String, ForeignKey, ForeignKeyConstraint
from testlib.sa.orm import relation, create_session
from testlib.testing import eq_
-from testlib.compat import set
from orm._base import ComparableEntity
diff --git a/test/orm/_base.py b/test/orm/_base.py
index de3bde3b4..4523a3223 100644
--- a/test/orm/_base.py
+++ b/test/orm/_base.py
@@ -4,7 +4,7 @@ import sys
import types
from testlib import config, sa, testing
from testlib.testing import resolve_artifact_names, adict
-from testlib.compat import set, sorted, _function_named
+from testlib.compat import _function_named
_repr_stack = set()
diff --git a/test/orm/_fixtures.py b/test/orm/_fixtures.py
index 6be6c7bd0..77dd510b2 100644
--- a/test/orm/_fixtures.py
+++ b/test/orm/_fixtures.py
@@ -1,6 +1,5 @@
from testlib.sa import MetaData, Table, Column, Integer, String, ForeignKey
from testlib.sa.orm import attributes
-from testlib.compat import set
from testlib.testing import fixture
from orm import _base
diff --git a/test/orm/collection.py b/test/orm/collection.py
index a6303d1fc..fd0f38909 100644
--- a/test/orm/collection.py
+++ b/test/orm/collection.py
@@ -10,17 +10,9 @@ from testlib.sa import Table, Column, Integer, String, ForeignKey
from testlib.sa import util, exc as sa_exc
from testlib.sa.orm import create_session, mapper, relation, \
attributes
-from testlib.compat import set, frozenset
from orm import _base
-try:
- py_set = set
-except NameError:
- import sets
- py_set = sets.Set
-
-
class Canary(sa.orm.interfaces.AttributeExtension):
def __init__(self):
self.data = set()
@@ -749,7 +741,7 @@ class CollectionsTest(_base.ORMTest):
def test_set_emulates(self):
class SetIsh(object):
- __emulates__ = py_set
+ __emulates__ = set
def __init__(self):
self.data = set()
def add(self, item):
diff --git a/test/orm/generative.py b/test/orm/generative.py
index dd2709202..6b3bf8c84 100644
--- a/test/orm/generative.py
+++ b/test/orm/generative.py
@@ -3,7 +3,6 @@ from testlib import testing, sa
from testlib.sa import Table, Column, Integer, String, ForeignKey, MetaData, func
from sqlalchemy.orm import mapper, relation, create_session
from testlib.testing import eq_
-from testlib.compat import set
from orm import _base, _fixtures
diff --git a/test/orm/mapper.py b/test/orm/mapper.py
index 61ff8f250..cc994acef 100644
--- a/test/orm/mapper.py
+++ b/test/orm/mapper.py
@@ -6,7 +6,6 @@ from testlib.sa import MetaData, Table, Column, Integer, String, ForeignKey
from testlib.sa.orm import mapper, relation, backref, create_session
from testlib.sa.orm import defer, deferred, synonym, attributes
from testlib.testing import eq_
-from testlib.compat import set
import pickleable
from orm import _base, _fixtures
diff --git a/test/orm/naturalpks.py b/test/orm/naturalpks.py
index d3fd5db29..c9a5a7176 100644
--- a/test/orm/naturalpks.py
+++ b/test/orm/naturalpks.py
@@ -7,7 +7,6 @@ from testlib import sa, testing
from testlib.sa import Table, Column, Integer, String, ForeignKey
from testlib.sa.orm import mapper, relation, create_session
from testlib.testing import eq_
-from testlib.compat import sorted
from orm import _base
class NaturalPKTest(_base.MappedTest):
diff --git a/test/orm/relationships.py b/test/orm/relationships.py
index 54b6975c2..87f674b9f 100644
--- a/test/orm/relationships.py
+++ b/test/orm/relationships.py
@@ -4,7 +4,6 @@ from testlib import sa, testing
from testlib.sa import Table, Column, Integer, String, ForeignKey
from testlib.sa.orm import mapper, relation, backref, create_session
from testlib.testing import eq_, startswith_
-from testlib.compat import set
from orm import _base
diff --git a/test/orm/session.py b/test/orm/session.py
index 1e2b3c9dd..df9536650 100644
--- a/test/orm/session.py
+++ b/test/orm/session.py
@@ -7,7 +7,6 @@ from testlib import engines, sa, testing, config
from testlib.sa import Table, Column, Integer, String
from testlib.sa.orm import mapper, relation, backref
from testlib.testing import eq_
-from testlib.compat import set
from engine import _base as engine_base
from orm import _base, _fixtures
diff --git a/test/orm/unitofwork.py b/test/orm/unitofwork.py
index 371335b07..90134d142 100644
--- a/test/orm/unitofwork.py
+++ b/test/orm/unitofwork.py
@@ -10,7 +10,6 @@ from testlib import engines, sa, testing
from testlib.sa import Table, Column, Integer, String, ForeignKey, literal_column
from testlib.sa.orm import mapper, relation, create_session, column_property
from testlib.testing import eq_, ne_
-from testlib.compat import set
from orm import _base, _fixtures
from engine import _base as engine_base
import pickleable
diff --git a/test/sql/defaults.py b/test/sql/defaults.py
index fbea5888e..dfd626b72 100644
--- a/test/sql/defaults.py
+++ b/test/sql/defaults.py
@@ -4,7 +4,6 @@ from sqlalchemy import Sequence, Column, func
from testlib import sa, testing
from testlib.sa import MetaData, Table, Integer, String, ForeignKey
from testlib.testing import eq_
-from testlib.compat import set
from sql import _base
diff --git a/test/sql/generative.py b/test/sql/generative.py
index cb5406b75..f6b849e8a 100644
--- a/test/sql/generative.py
+++ b/test/sql/generative.py
@@ -197,7 +197,7 @@ class ClauseTest(TestBase, AssertsCompiledSQL):
assert c1 == str(clause)
assert str(clause2) == c1 + " SOME MODIFIER=:lala"
assert clause.bindparams.keys() == ['bar']
- assert util.Set(clause2.bindparams.keys()) == util.Set(['bar', 'lala'])
+ assert set(clause2.bindparams.keys()) == set(['bar', 'lala'])
def test_select(self):
s2 = select([t1])
diff --git a/test/testlib/__init__.py b/test/testlib/__init__.py
index d0850cf42..5dea60322 100644
--- a/test/testlib/__init__.py
+++ b/test/testlib/__init__.py
@@ -18,7 +18,7 @@ from testlib.orm import mapper
import testlib.profiling as profiling
import testlib.engines as engines
import testlib.requires as requires
-from testlib.compat import set, frozenset, sorted, _function_named
+from testlib.compat import _function_named
__all__ = ('testing',
@@ -28,7 +28,7 @@ __all__ = ('testing',
'TestBase', 'AssertsExecutionResults', 'ORMTest',
'AssertsCompiledSQL', 'ComparesTables',
'profiling', 'engines',
- 'set', 'frozenset', 'sorted', '_function_named')
+ '_function_named')
testing.requires = requires
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:
diff --git a/test/testlib/engines.py b/test/testlib/engines.py
index 69f5f1865..73ac80632 100644
--- a/test/testlib/engines.py
+++ b/test/testlib/engines.py
@@ -1,6 +1,7 @@
import sys, types, weakref
+from collections import deque
from testlib import config
-from testlib.compat import set, _function_named, deque
+from testlib.compat import _function_named
class ConnectionKiller(object):
def __init__(self):
diff --git a/test/testlib/fixtures.py b/test/testlib/fixtures.py
index baaac4660..854cd7c5a 100644
--- a/test/testlib/fixtures.py
+++ b/test/testlib/fixtures.py
@@ -1,7 +1,6 @@
from testlib.sa import MetaData, Table, Column, Integer, String, ForeignKey
from testlib.sa.orm import attributes
from testlib.testing import ORMTest
-from testlib.compat import set
__all__ = ['keywords', 'addresses', 'Base', 'Keyword', 'FixtureTest',
diff --git a/test/testlib/orm.py b/test/testlib/orm.py
index d9664f52f..b460102a6 100644
--- a/test/testlib/orm.py
+++ b/test/testlib/orm.py
@@ -1,6 +1,5 @@
import inspect, re
from testlib import config, testing
-from testlib.compat import sorted
sa = None
orm = None
diff --git a/test/testlib/profiling.py b/test/testlib/profiling.py
index e423b9904..5a406a756 100644
--- a/test/testlib/profiling.py
+++ b/test/testlib/profiling.py
@@ -1,7 +1,7 @@
"""Profiling support for unit and performance tests."""
import os, sys
-from testlib.compat import set, _function_named
+from testlib.compat import _function_named
import testlib.config
__all__ = 'profiled', 'function_call_count', 'conditional_call_count'
diff --git a/test/testlib/testing.py b/test/testlib/testing.py
index e09899e0c..1c3b0f0bc 100644
--- a/test/testlib/testing.py
+++ b/test/testlib/testing.py
@@ -12,7 +12,7 @@ import warnings
from cStringIO import StringIO
import testlib.config as config
-from testlib.compat import set, _function_named, reversed
+from testlib.compat import _function_named
# Delayed imports
MetaData = None
diff --git a/test/zblog/blog.py b/test/zblog/blog.py
index 9e48a202f..4c7635430 100644
--- a/test/zblog/blog.py
+++ b/test/zblog/blog.py
@@ -1,7 +1,7 @@
-__all__ = ['Blog', 'Post', 'Topic', 'TopicAssociation', 'Comment']
-
import datetime
-from testlib.compat import *
+
+
+__all__ = ['Blog', 'Post', 'Topic', 'TopicAssociation', 'Comment']
class Blog(object):
def __init__(self, owner=None):