[Zope3-checkins] CVS: Zope3/src/zope/app/rdb/tests - test_zopecursor.py:1.5
Sidnei da Silva
sidnei@x3ng.com.br
Fri, 4 Jul 2003 09:52:34 -0400
Update of /cvs-repository/Zope3/src/zope/app/rdb/tests
In directory cvs.zope.org:/tmp/cvs-serv6843/tests
Modified Files:
test_zopecursor.py
Log Message:
Now its really fixed. Fetchone returns 'None' when there are no more results, according to the docstring
=== Zope3/src/zope/app/rdb/tests/test_zopecursor.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/rdb/tests/test_zopecursor.py:1.4 Fri Jul 4 09:33:38 2003
+++ Zope3/src/zope/app/rdb/tests/test_zopecursor.py Fri Jul 4 09:52:30 2003
@@ -38,16 +38,18 @@
class MyCursorStub(CursorStub):
+ _raw = raw
+
description = ((None, 'string'), (None, 'int'), (None, 'foo'))
def fetchone(self):
- return raw[:1][0]
+ return self._raw[:1][0]
def fetchall(self):
- return raw
+ return self._raw
def fetchmany(self, size=2):
- return raw[:size]
+ return self._raw[:size]
class MyTypeInfoStub(TypeInfoStub):
@@ -86,6 +88,14 @@
def test_cursor_fetchone(self):
results = self.cursor.fetchone()
expected = converted[:1][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
+ results = self.cursor.fetchone()
+ expected = None
self.assertEqual(results, expected,
'type conversion was not performed in cursor.fetchone:\n'
'got %r, expected %r' % (results, expected))