Add fetch_where, a single conditional wrapper around fetch_if, similar to fetch_equals
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import unittest
|
||||
from datalite import datalite, fetch_if, fetch_all, fetch_range, fetch_from, fetch_equals
|
||||
from datalite import datalite, fetch_if, fetch_all, fetch_range, fetch_from, fetch_equals, fetch_where
|
||||
from sqlite3 import connect
|
||||
from dataclasses import dataclass, asdict
|
||||
from os import remove
|
||||
@@ -94,6 +94,10 @@ class DatabaseFetchCalls(unittest.TestCase):
|
||||
t_objs = fetch_if(FetchClass, "str_ = \"b\"")
|
||||
self.assertEqual(tuple(self.objs[1:]), t_objs)
|
||||
|
||||
def testFetchWhere(self):
|
||||
t_objs = fetch_where(FetchClass, 'str_', 'b')
|
||||
self.assertEqual(tuple(self.objs[1:]), t_objs)
|
||||
|
||||
def testFetchRange(self):
|
||||
t_objs = fetch_range(FetchClass, range(self.objs[0].obj_id, self.objs[2].obj_id))
|
||||
self.assertEqual(tuple(self.objs[0:2]), t_objs)
|
||||
|
||||
Reference in New Issue
Block a user