added test for table dropping
This commit is contained in:
parent
ee844732b2
commit
e217d18007
@ -2,6 +2,7 @@ import unittest
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from dataset import connect
|
from dataset import connect
|
||||||
|
from dataset.util import DatasetException
|
||||||
from sample_data import TEST_DATA
|
from sample_data import TEST_DATA
|
||||||
|
|
||||||
class DatabaseTestCase(unittest.TestCase):
|
class DatabaseTestCase(unittest.TestCase):
|
||||||
@ -101,6 +102,16 @@ class TableTestCase(unittest.TestCase):
|
|||||||
self.tbl.insert_many(data)
|
self.tbl.insert_many(data)
|
||||||
assert len(self.tbl) == len(data) + 6
|
assert len(self.tbl) == len(data) + 6
|
||||||
|
|
||||||
|
def test_drop_warning(self):
|
||||||
|
assert self.tbl._is_dropped is False, 'table shouldn\'t be dropped yet'
|
||||||
|
self.tbl.drop()
|
||||||
|
assert self.tbl._is_dropped is True, 'table should be dropped now'
|
||||||
|
try:
|
||||||
|
list(self.tbl.all())
|
||||||
|
except DatasetException:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
assert False, 'we should not reach else block, no exception raised!'
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user