forked from Pylons/paginate_sqlalchemy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TODO
45 lines (39 loc) · 1.41 KB
/
TODO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Support Select objects
Upload to PyPi
Announce to pylons-discussion mailing list.
Write SQLAlchemy tests
Create test with setup/teardown code for paginate.sqlalchemy.SqlalchemyPage (e.g. sqlite)
#class TestSQLAlchemyCollectionTypes(unittest.TestCase):
# def setUp(self):
# try:
# import sqlalchemy as sa
# import sqlalchemy.orm as orm
# except ImportError:
# raise SkipTest()
# self.engine = engine = sa.create_engine("sqlite://") # Memory database
# self.sessionmaker = orm.sessionmaker(bind=engine)
# self.metadata = metadata = sa.MetaData(bind=engine)
# self.notes = notes = sa.Table("Notes", metadata,
# sa.Column("id", sa.Integer, primary_key=True))
# class Note(object):
# pass
# self.Note = Note
# notes.create()
# orm.mapper(Note, notes)
# insert = notes.insert()
# records = [{"id": x} for x in range(1, 101)]
# engine.execute(insert, records)
#
# def tearDown(self):
# import sqlalchemy as sa
# import sqlalchemy.orm as orm
# orm.clear_mappers()
# self.notes.drop()
#
# def test_sqlalchemy_orm(self):
# session = self.sessionmaker()
# q = session.query(self.Note).order_by(self.Note.id)
# page = paginate.Page(q)
# records = list(page)
# eq_(records[0].id, 1)
# eq_(records[-1].id, 20)