_chain_decorators_on, \
exclude, \
emits_warning_on,\
- skip_if
+ skip_if,\
+ fails_on
import testing
import sys
no_support('firebird', 'not supported by database'),
no_support('oracle', 'not supported by database'),
no_support('mssql', 'not supported by database'),
+ no_support('sybase', 'not supported by database'),
+ no_support('maxdb', 'FIXME: verify not supported by database'),
)
def identity(fn):
exclude('mysql', '<', (4, 1, 1), 'no subquery support'),
)
+def intersect(fn):
+ """Target database must support INTERSECT or equivlaent."""
+ return _chain_decorators_on(
+ fn,
+ fails_on('firebird', 'no support for INTERSECT'),
+ fails_on('mysql', 'no support for INTERSECT'),
+ fails_on('sybase', 'no support for INTERSECT'),
+ )
+
+def except_(fn):
+ """Target database must support EXCEPT or equivlaent (i.e. MINUS)."""
+ return _chain_decorators_on(
+ fn,
+ fails_on('firebird', 'no support for EXCEPT'),
+ fails_on('mysql', 'no support for EXCEPT'),
+ fails_on('sybase', 'no support for EXCEPT'),
+ )
+
+def offset(fn):
+ """Target database must support some method of adding OFFSET or equivalent to a result set."""
+ return _chain_decorators_on(
+ fn,
+ fails_on('sybase', 'no support for OFFSET or equivalent'),
+ )
+
def returning(fn):
return _chain_decorators_on(
fn,
assert len(r) == 3
-
@testing.emits_warning('.*empty sequence.*')
- @testing.fails_on('firebird', 'FIXME: unknown')
- @testing.fails_on('maxdb', 'FIXME: unknown')
- @testing.fails_on('oracle', 'FIXME: unknown')
- @testing.fails_on('mssql', 'FIXME: unknown')
+ @testing.requires.boolean_col_expressions
def test_in_filtering_advanced(self):
- """test the behavior of the in_() function when comparing against an empty collection."""
+ """test the behavior of the in_() function when
+ comparing against an empty collection, specifically
+ that a proper boolean value is generated.
+
+ """
users.insert().execute(user_id = 7, user_name = 'jack')
users.insert().execute(user_id = 8, user_name = 'fred')
r = users.select(limit=3, order_by=[users.c.user_id]).execute().fetchall()
self.assert_(r == [(1, 'john'), (2, 'jack'), (3, 'ed')], repr(r))
+ @testing.requires.offset
@testing.fails_on('maxdb', 'FIXME: unknown')
def test_select_limit_offset(self):
"""Test the interaction between limit and offset"""
self.assert_(len(r) == 3, repr(r))
self.assert_(r[0] != r[1] and r[1] != r[2], repr(r))
+ @testing.requires.offset
@testing.fails_on('mssql', 'FIXME: unknown')
def test_select_distinct_offset(self):
"""Test the interaction between distinct and offset"""
self.assert_(len(r) == 4, repr(r))
self.assert_(r[0] != r[1] and r[1] != r[2] and r[2] != [3], repr(r))
+ @testing.requires.offset
def test_select_distinct_limit_offset(self):
"""Test the interaction between limit and limit/offset"""
found2 = self._fetchall_sorted(e.alias('foo').select().execute())
eq_(found2, wanted)
- @testing.crashes('firebird', 'Does not support intersect')
- @testing.crashes('sybase', 'FIXME: unknown, verify not fails_on')
- @testing.fails_on('mysql', 'FIXME: unknown')
+ @testing.requires.intersect
def test_intersect(self):
i = intersect(
select([t2.c.col3, t2.c.col4]),
found2 = self._fetchall_sorted(i.alias('bar').select().execute())
eq_(found2, wanted)
- @testing.crashes('firebird', 'Does not support except')
- @testing.crashes('sybase', 'FIXME: unknown, verify not fails_on')
- @testing.fails_on('mysql', 'FIXME: unknown')
+ @testing.requires.except_
@testing.fails_on('sqlite', "Can't handle this style of nesting")
def test_except_style1(self):
e = except_(union(
found = self._fetchall_sorted(e.alias().select().execute())
eq_(found, wanted)
- @testing.crashes('firebird', 'Does not support except')
- @testing.crashes('sybase', 'FIXME: unknown, verify not fails_on')
- @testing.fails_on('mysql', 'FIXME: unknown')
+ @testing.requires.except_
def test_except_style2(self):
# same as style1, but add alias().select() to the except_().
# sqlite can handle it now.
found2 = self._fetchall_sorted(e.alias().select().execute())
eq_(found2, wanted)
- @testing.crashes('firebird', 'Does not support except')
- @testing.crashes('sybase', 'FIXME: unknown, verify not fails_on')
- @testing.fails_on('mysql', 'FIXME: unknown')
@testing.fails_on('sqlite', "Can't handle this style of nesting")
+ @testing.requires.except_
def test_except_style3(self):
# aaa, bbb, ccc - (aaa, bbb, ccc - (ccc)) = ccc
e = except_(
eq_(e.alias('foo').select().execute().fetchall(),
[('ccc',)])
- @testing.crashes('firebird', 'Does not support except')
- @testing.crashes('sybase', 'FIXME: unknown, verify not fails_on')
- @testing.fails_on('mysql', 'FIXME: unknown')
+ @testing.requires.except_
def test_except_style4(self):
# aaa, bbb, ccc - (aaa, bbb, ccc - (ccc)) = ccc
e = except_(
[('ccc',)]
)
- @testing.crashes('firebird', 'Does not support intersect')
- @testing.fails_on('mysql', 'FIXME: unknown')
+ @testing.requires.intersect
@testing.fails_on('sqlite', "sqlite can't handle leading parenthesis")
def test_intersect_unions(self):
u = intersect(
eq_(found, wanted)
- @testing.crashes('firebird', 'Does not support intersect')
- @testing.fails_on('mysql', 'FIXME: unknown')
+ @testing.requires.intersect
def test_intersect_unions_2(self):
u = intersect(
union(
eq_(found, wanted)
- @testing.crashes('firebird', 'Does not support intersect')
- @testing.fails_on('mysql', 'FIXME: unknown')
- def test_intersect(self):
+ @testing.requires.intersect
+ def test_intersect_unions_3(self):
u = intersect(
select([t2.c.col3, t2.c.col4]),
union(
eq_(found, wanted)
- @testing.crashes('firebird', 'Does not support intersect')
- @testing.fails_on('mysql', 'FIXME: unknown')
+ @testing.requires.intersect
def test_composite_alias(self):
ua = intersect(
select([t2.c.col3, t2.c.col4]),
global metadata, flds
metadata = MetaData(testing.db)
flds = Table('flds', metadata,
- Column('idcol', Integer, Sequence('t1pkseq'), primary_key=True),
+ Column('idcol', Integer, primary_key=True, test_needs_autoincrement=True),
Column('intcol', Integer),
Column('strcol', String(50)),
)
@classmethod
def teardown_class(cls):
metadata.drop_all()
-
- @testing.fails_on('maxdb', 'FIXME: unknown')
+
+ # TODO: seems like more tests warranted for this setup.
+
def test_modulo(self):
eq_(
select([flds.c.intcol % 3],