Permalink
Browse files

with better iterbetter, bool test can be done on sqlite results too

  • Loading branch information...
1 parent fa655ca commit 9e5e40492f6e141df977a93def73423702038bcd @anandology anandology committed Nov 4, 2009
Showing with 5 additions and 4 deletions.
  1. +5 −0 test/db.py
  2. +0 −4 web/db.py
View
5 test/db.py
@@ -99,6 +99,11 @@ def test_result_is_unicode(self):
name = db.select('person')[0].name
self.assertEquals(type(name), unicode)
+ def test_result_is_true(self):
+ db = webtest.setup_database(self.dbname)
+ self.db.insert('person', False, name='user')
+ self.assertEquals(bool(db.select('person')), True)
+
def testBoolean(self):
def t(active):
name ='name-%s' % active
View
4 web/db.py
@@ -966,11 +966,7 @@ def _process_insert_query(self, query, tablename, seqname):
def query(self, *a, **kw):
out = DB.query(self, *a, **kw)
if isinstance(out, iterbetter):
- # rowcount is not provided by sqlite
- def _nonzero():
- raise self.db_module.NotSupportedError("rowcount is not supported by sqlite")
del out.__len__
- out.__nonzero__ = _nonzero
return out
class FirebirdDB(DB):

0 comments on commit 9e5e404

Please sign in to comment.