Files
sqlalchemy/test/dialect/test_access.py
T
Mike Bayer 68a350d462 - remove test.sql._base, test.engine._base, test.orm._base, move those classes to a new test.lib.fixtures module
- move testing.TestBase to test.lib.fixtures
- massive search and replace
2011-03-27 16:27:27 -04:00

32 lines
786 B
Python

from sqlalchemy import *
from sqlalchemy import sql
from sqlalchemy.databases import access
from test.lib import *
class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
__dialect__ = access.dialect()
def test_extract(self):
t = sql.table('t', sql.column('col1'))
mapping = {
'month': 'm',
'day': 'd',
'year': 'yyyy',
'second': 's',
'hour': 'h',
'doy': 'y',
'minute': 'n',
'quarter': 'q',
'dow': 'w',
'week': 'ww'
}
for field, subst in mapping.items():
self.assert_compile(
select([extract(field, t.c.col1)]),
'SELECT DATEPART("%s", t.col1) AS anon_1 FROM t' % subst)