From: Mike Bayer Date: Sun, 11 Apr 2010 19:37:20 +0000 (-0400) Subject: - added a test for the solution in [ticket:1757]. X-Git-Tag: rel_0_6_0~23^2~15^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fc157ed8c57b7fcfea6b76688d4733c87c4f8e82;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - added a test for the solution in [ticket:1757]. - this does imply that a lot of the "test the RowProxy" tests in sql/test_query might be better off in engine/test_execute or perhaps engine/test_resultproxy --- diff --git a/test/engine/test_execute.py b/test/engine/test_execute.py index 04d4a06d50..de1de225f5 100644 --- a/test/engine/test_execute.py +++ b/test/engine/test_execute.py @@ -181,7 +181,28 @@ class LogTest(TestBase): "0x...%s" % hex(id(eng.pool))[-4:], ) - +class RowInterpTest(TestBase): + def test_nontuple_row(self): + """ensure the C version of BaseRowProxy handles + duck-type-dependent rows.""" + + from sqlalchemy.engine import RowProxy + + class MyList(object): + def __init__(self, l): + self.l = l + + def __len__(self): + return len(self.l) + + def __getitem__(self, i): + return list.__getitem__(self.l, i) + + proxy = RowProxy(object(), MyList(['value']), [None], {'key': (None, 0), 0: (None, 0)}) + eq_(list(proxy), ['value']) + eq_(proxy[0], 'value') + eq_(proxy['key'], 'value') + class ProxyConnectionTest(TestBase): @testing.fails_on('firebird', 'Data type unknown')