def test_exclude_constraint_min(self):
m = MetaData()
- tbl = Table('testtbl', m,
+ tbl = Table('testtbl', m,
Column('room', Integer, primary_key=True))
cons = ExcludeConstraint(('room', '='))
tbl.append_constraint(cons)
def test_exclude_constraint_copy(self):
m = MetaData()
cons = ExcludeConstraint(('room', '='))
- tbl = Table('testtbl', m,
+ tbl = Table('testtbl', m,
Column('room', Integer, primary_key=True),
cons)
# apparently you can't copy a ColumnCollectionConstraint until
)).execute().fetchall()
eq_([3], [r.id for r in results])
- @testing.requires.english_locale_on_postgresql
def test_simple_derivative_match(self):
results = \
matchtable.select().where(matchtable.c.title.match('nutshells'
)).execute().fetchall()
eq_([5], [r.id for r in results])
- @testing.requires.english_locale_on_postgresql
def test_or_match(self):
results1 = \
matchtable.select().where(or_(matchtable.c.title.match('nutshells'
)).order_by(matchtable.c.id).execute().fetchall()
eq_([3, 5], [r.id for r in results2])
- @testing.requires.english_locale_on_postgresql
def test_and_match(self):
results1 = \
matchtable.select().where(and_(matchtable.c.title.match('python'
)).execute().fetchall()
eq_([5], [r.id for r in results2])
- @testing.requires.english_locale_on_postgresql
def test_match_across_joins(self):
results = matchtable.select().where(and_(cattable.c.id
== matchtable.c.category_id,
# older psycopg2 versions.
from psycopg2 import extras
return extras
-
+
@classmethod
def define_tables(cls, metadata):
# no reason ranges shouldn't be primary keys,
def test_actual_type(self):
eq_(str(self._col_type()), self._col_str)
-
+
def test_reflect(self):
from sqlalchemy import inspect
insp = inspect(testing.db)
self._assert_data()
# operator tests
-
+
def _test_clause(self, colclause, expected):
dialect = postgresql.dialect()
compiled = str(colclause.compile(dialect=dialect))
select([range + range])
).fetchall()
eq_(data, [(self._data_obj(), )])
-
+
def test_intersection(self):
self._test_clause(
select([range * range])
).fetchall()
eq_(data, [(self._data_obj(), )])
-
+
def test_different(self):
self._test_clause(
self.col - self.col,
select([range - range])
).fetchall()
eq_(data, [(self._data_obj().__class__(empty=True), )])
-
+
class Int4RangeTests(_RangeTypeMixin, fixtures.TablesTest):
_col_type = INT4RANGE
@property
def _data_str(self):
return '[%s,%s)' % self.tstzs()
-
+
def _data_obj(self):
return self.extras.DateTimeTZRange(*self.tstzs())