~ubuntu-branches/debian/jessie/sqlalchemy/jessie

« back to all changes in this revision

Viewing changes to test/dialect/test_access.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski, Jakub Wilk, Piotr Ożarowski
  • Date: 2013-07-06 20:53:52 UTC
  • mfrom: (1.4.23) (16.1.17 experimental)
  • Revision ID: package-import@ubuntu.com-20130706205352-ryppl1eto3illd79
Tags: 0.8.2-1
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Piotr Ożarowski ]
* New upstream release
* Upload to unstable
* Build depend on python3-all instead of -dev, extensions are not built for
  Python 3.X 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from sqlalchemy import *
2
 
from sqlalchemy import sql
3
 
from sqlalchemy.databases import access
4
 
from test.lib import *
5
 
 
6
 
 
7
 
class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
8
 
    __dialect__ = access.dialect()
9
 
 
10
 
    def test_extract(self):
11
 
        t = sql.table('t', sql.column('col1'))
12
 
 
13
 
        mapping = {
14
 
            'month': 'm',
15
 
            'day': 'd',
16
 
            'year': 'yyyy',
17
 
            'second': 's',
18
 
            'hour': 'h',
19
 
            'doy': 'y',
20
 
            'minute': 'n',
21
 
            'quarter': 'q',
22
 
            'dow': 'w',
23
 
            'week': 'ww'
24
 
            }
25
 
 
26
 
        for field, subst in mapping.items():
27
 
            self.assert_compile(
28
 
                select([extract(field, t.c.col1)]),
29
 
                'SELECT DATEPART("%s", t.col1) AS anon_1 FROM t' % subst)
30
 
 
31