Add a test case for table cache updates
This test case verifies whether get_table returns the most up-to-date table object containing all columns that has been added to the table since the last cache update.
This commit is contained in:
parent
a4d676f325
commit
a9abc9908d
@ -121,6 +121,13 @@ class DatabaseTestCase(unittest.TestCase):
|
|||||||
r = self.db.query('SELECT COUNT(*) AS num FROM weather').next()
|
r = self.db.query('SELECT COUNT(*) AS num FROM weather').next()
|
||||||
assert r['num'] == len(TEST_DATA), r
|
assert r['num'] == len(TEST_DATA), r
|
||||||
|
|
||||||
|
def test_table_cache_updates(self):
|
||||||
|
tbl1 = self.db.get_table('people')
|
||||||
|
tbl1.insert(dict(first_name='John', last_name='Smith'))
|
||||||
|
tbl2 = self.db.get_table('people')
|
||||||
|
|
||||||
|
assert list(tbl2.all()) == [(1, 'John', 'Smith')]
|
||||||
|
|
||||||
|
|
||||||
class TableTestCase(unittest.TestCase):
|
class TableTestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user