[Zope3-checkins] CVS: Zope3/src/zope/app/rdb/tests - test_zopecursor.py:1.6

Sidnei da Silva sidnei@x3ng.com.br
Fri, 4 Jul 2003 10:29:39 -0400


Update of /cvs-repository/Zope3/src/zope/app/rdb/tests
In directory cvs.zope.org:/tmp/cvs-serv12310/tests

Modified Files:
	test_zopecursor.py 
Log Message:
Ok I must have been drunk when I checked in that. Much less obscure code, thanks to Marius Gedminas help.

=== Zope3/src/zope/app/rdb/tests/test_zopecursor.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/rdb/tests/test_zopecursor.py:1.5	Fri Jul  4 09:52:30 2003
+++ Zope3/src/zope/app/rdb/tests/test_zopecursor.py	Fri Jul  4 10:29:35 2003
@@ -43,7 +43,10 @@
     description = ((None, 'string'), (None, 'int'), (None, 'foo'))
 
     def fetchone(self):
-        return self._raw[:1][0]
+        if self._raw:
+            return self._raw[0]
+        else:
+            return None
 
     def fetchall(self):
         return self._raw
@@ -87,13 +90,13 @@
 
     def test_cursor_fetchone(self):
         results = self.cursor.fetchone()
-        expected = converted[:1][0]
+        expected = converted[0]
         self.assertEqual(results, expected,
                    'type conversion was not performed in cursor.fetchone:\n'
                    'got %r, expected %r' % (results, expected))
 
     def test_cursor_fetchone_no_more_results(self):
-        self.cursor._raw[0] = None
+        self.cursor.cursor._raw = [] 
         results = self.cursor.fetchone()
         expected = None
         self.assertEqual(results, expected,