From 1bf0aee385e3164254bed0dcc6e005613806a665 Mon Sep 17 00:00:00 2001 From: Jason Kirtland Date: Thu, 1 Nov 2007 19:40:08 +0000 Subject: [PATCH] Added rowset() testing helper. --- test/testlib/__init__.py | 2 ++ test/testlib/testing.py | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/test/testlib/__init__.py b/test/testlib/__init__.py index 29b258c9f8..d7daaddf8b 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 a1fb174b73..43bbb92ff2 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.""" -- 2.47.3