]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Added rowset() testing helper.
authorJason Kirtland <jek@discorporate.us>
Thu, 1 Nov 2007 19:40:08 +0000 (19:40 +0000)
committerJason Kirtland <jek@discorporate.us>
Thu, 1 Nov 2007 19:40:08 +0000 (19:40 +0000)
test/testlib/__init__.py
test/testlib/testing.py

index 29b258c9f810f407336c830b2687887ca94148f7..d7daaddf8ba156733466deacab308b92f66595f4 100644 (file)
@@ -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')
index a1fb174b73bf4b9f92d74e8cf768b3443ab14da1..43bbb92ff2a5a844c79c62982c05068687221260 100644 (file)
@@ -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."""