diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-11-19 19:29:18 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-11-19 19:29:18 -0500 |
commit | 02f21ffcf366da406795334d2fc6908a2f3c9b2f (patch) | |
tree | f3f92d882667d7133f9e623335134dd4dc59a5b0 /test/sql/test_query.py | |
parent | 63508b82cd5710c660383bcac5fcfd3bb6af83c1 (diff) | |
download | sqlalchemy-02f21ffcf366da406795334d2fc6908a2f3c9b2f.tar.gz |
- The :class:`.RowProxy` object is now sortable in Python as a regular
tuple is; this is accomplished via ensuring tuple() conversion on
both sides within the ``__eq__()`` method as well as
the addition of a ``__lt__()`` method. [ticket:2848]
Diffstat (limited to 'test/sql/test_query.py')
-rw-r--r-- | test/sql/test_query.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/sql/test_query.py b/test/sql/test_query.py index 8e619fe74..8c5e1db4d 100644 --- a/test/sql/test_query.py +++ b/test/sql/test_query.py @@ -1090,6 +1090,19 @@ class QueryTest(fixtures.TestBase): eq_(len(r), 1) + def test_sorting_in_python(self): + users.insert().execute( + dict(user_id=1, user_name='foo'), + dict(user_id=2, user_name='bar'), + dict(user_id=3, user_name='def'), + ) + + rows = users.select().order_by(users.c.user_name).execute().fetchall() + + eq_(rows, [(2, 'bar'), (3, 'def'), (1, 'foo')]) + + eq_(sorted(rows), [(1, 'foo'), (2, 'bar'), (3, 'def')]) + def test_column_order_with_simple_query(self): # should return values in column definition order users.insert().execute(user_id=1, user_name='foo') |