~romaia/stoqlib/storm-old

« back to all changes in this revision

Viewing changes to external/sqlobject/tests/test_sorting_old.py

  • Committer: jdahlin
  • Date: 2006-09-18 16:01:22 UTC
  • Revision ID: vcs-imports@canonical.com-20060918160122-umda7g8dx7bdc53m
Add an external directory with formencode and SQLObject forks, remove SQLObject dependency from documentation and setup.py. Install externals and set sys.path in stoqlib/__init__.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from sqlobject import *
 
2
from sqlobject.tests.dbtest import *
 
3
 
 
4
deprecated_module()
 
5
 
 
6
class OldNames(SQLObject):
 
7
 
 
8
    _table = 'names_table'
 
9
 
 
10
    firstName = StringCol(length=30)
 
11
    lastName = StringCol(length=30)
 
12
 
 
13
    _defaultOrder = ['lastName', 'firstName']
 
14
 
 
15
def setupNames():
 
16
    setupClass(OldNames)
 
17
    inserts(OldNames, [('aj', 'baker'), ('joe', 'robbins'),
 
18
                    ('tim', 'jackson'), ('joe', 'baker'),
 
19
                    ('zoe', 'robbins')],
 
20
            schema='firstName lastName')
 
21
 
 
22
def nameList(names):
 
23
    result = []
 
24
    for name in names:
 
25
        result.append('%s %s' % (name.firstName, name.lastName))
 
26
    return result
 
27
 
 
28
def firstList(names):
 
29
    return [n.firstName for n in names]
 
30
 
 
31
def test_defaultOrder():
 
32
    setupNames()
 
33
    assert nameList(OldNames.select()) == \
 
34
           ['aj baker', 'joe baker',
 
35
            'tim jackson', 'joe robbins',
 
36
            'zoe robbins']