diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-02-06 15:49:32 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-02-06 15:49:32 -0500 |
| commit | 2121c1690a17090a4027874751e90d02b4126fd2 (patch) | |
| tree | 964a461f3d2ae21c6fcb3dd425d94e1274ee2776 /lib/sqlalchemy/testing/suite/test_results.py | |
| parent | 17790c9896e8ace4276b12b5f2cfcd366afae7e9 (diff) | |
| download | sqlalchemy-2121c1690a17090a4027874751e90d02b4126fd2.tar.gz | |
- add an "empty_inserts" requirement target plus a suite test
- add suite tests for basic explicit Sequence support, result-row column access (tests that name_normalize is set correctly among many other things)
Diffstat (limited to 'lib/sqlalchemy/testing/suite/test_results.py')
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_results.py | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_results.py b/lib/sqlalchemy/testing/suite/test_results.py new file mode 100644 index 000000000..f81e30e0b --- /dev/null +++ b/lib/sqlalchemy/testing/suite/test_results.py @@ -0,0 +1,69 @@ +from .. import fixtures, config +from ..config import requirements +from .. import exclusions +from ..assertions import eq_ +from .. import engines + +from sqlalchemy import Integer, String, select, util + +from ..schema import Table, Column + + +class RowFetchTest(fixtures.TablesTest): + + @classmethod + def define_tables(cls, metadata): + Table('plain_pk', metadata, + Column('id', Integer, primary_key=True), + Column('data', String(50)) + ) + + @classmethod + def insert_data(cls): + config.db.execute( + cls.tables.plain_pk.insert(), + [ + {"id":1, "data":"d1"}, + {"id":2, "data":"d2"}, + {"id":3, "data":"d3"}, + ] + ) + + def test_via_string(self): + row = config.db.execute( + self.tables.plain_pk.select().\ + order_by(self.tables.plain_pk.c.id) + ).first() + + eq_( + row['id'], 1 + ) + eq_( + row['data'], "d1" + ) + + def test_via_int(self): + row = config.db.execute( + self.tables.plain_pk.select().\ + order_by(self.tables.plain_pk.c.id) + ).first() + + eq_( + row[0], 1 + ) + eq_( + row[1], "d1" + ) + + def test_via_col_object(self): + row = config.db.execute( + self.tables.plain_pk.select().\ + order_by(self.tables.plain_pk.c.id) + ).first() + + eq_( + row[self.tables.plain_pk.c.id], 1 + ) + eq_( + row[self.tables.plain_pk.c.data], "d1" + )
\ No newline at end of file |
