]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- added a test for the solution in [ticket:1757].
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 11 Apr 2010 19:37:20 +0000 (15:37 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 11 Apr 2010 19:37:20 +0000 (15:37 -0400)
- 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

test/engine/test_execute.py

index 04d4a06d50aaf3721a03b8f45c6c3e2063c6004b..de1de225f5b7689e405e4bc6b34e99d6fcdd638e 100644 (file)
@@ -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')