diff options
| author | Jason Kirtland <jek@discorporate.us> | 2007-11-01 19:40:08 +0000 |
|---|---|---|
| committer | Jason Kirtland <jek@discorporate.us> | 2007-11-01 19:40:08 +0000 |
| commit | 1bf0aee385e3164254bed0dcc6e005613806a665 (patch) | |
| tree | 96b4854a5a616b1acc14eb2775a123728e83ce3b /test | |
| parent | ca73fbab87d271ed9e63f8f4f0d13036ac46279a (diff) | |
| download | sqlalchemy-1bf0aee385e3164254bed0dcc6e005613806a665.tar.gz | |
Added rowset() testing helper.
Diffstat (limited to 'test')
| -rw-r--r-- | test/testlib/__init__.py | 2 | ||||
| -rw-r--r-- | test/testlib/testing.py | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/test/testlib/__init__.py b/test/testlib/__init__.py index 29b258c9f..d7daaddf8 100644 --- a/test/testlib/__init__.py +++ b/test/testlib/__init__.py @@ -7,6 +7,7 @@ import testlib.config from testlib.schema import Table, Column from testlib.orm import mapper import testlib.testing as testing +from testlib.testing import rowset from testlib.testing import PersistTest, AssertMixin, ORMTest, SQLCompileTest import testlib.profiling as profiling import testlib.engines as engines @@ -15,5 +16,6 @@ import testlib.engines as engines __all__ = ('testing', 'mapper', 'Table', 'Column', + 'rowset', 'PersistTest', 'AssertMixin', 'ORMTest', 'SQLCompileTest', 'profiling', 'engines') diff --git a/test/testlib/testing.py b/test/testlib/testing.py index a1fb174b7..43bbb92ff 100644 --- a/test/testlib/testing.py +++ b/test/testlib/testing.py @@ -124,6 +124,14 @@ def against(*queries): return True return False +def rowset(results): + """Converts the results of sql execution into a plain set of column tuples. + + Useful for asserting the results of an unordered query. + """ + + return set([tuple(row) for row in results]) + class TestData(object): """Tracks SQL expressions as they are executed via an instrumented ExecutionContext.""" |
