Commit 7e2aab94 authored by Barry Warsaw's avatar Barry Warsaw

NewInsertsTest => MinimalNewInsertsTest

FullNewInsertsTest: new class which mirrors MinimalNewInsertsTest and
performs the same set of tests on the Full database.

Also add some better docstrings.

Added __main__ section so this test can be run standalone.
parent f2828e83
# Test creation of a brand new database, and insertion of root objects. # Test creation of a brand new database, and insertion of root objects.
import unittest import unittest
from test_create import BaseFramework import test_create
class NewInsertsTest(BaseFramework): class FullNewInsertsTest(test_create.FullBaseFramework):
def checkIsEmpty(self): def checkIsEmpty(self):
"""Checks that a newly created database is empty""" """Full: Newly created database should be empty"""
assert not self._root.has_key('names') assert not self._root.has_key('names')
def checkNewInserts(self): def checkNewInserts(self):
"""Full: Commiting on a newly created database"""
from BTree import BTree
self._root['names'] = names = BTree()
names['Warsaw'] = 'Barry'
names['Hylton'] = 'Jeremy'
get_transaction().commit()
class MinimalNewInsertsTest(test_create.MinimalBaseFramework):
def checkIsEmpty(self):
"""Minimal: Newly created database is empty"""
assert not self._root.has_key('names')
def checkNewInserts(self):
"""Minimal: Committing on a newly created database"""
from BTree import BTree from BTree import BTree
self._root['names'] = names = BTree() self._root['names'] = names = BTree()
...@@ -22,6 +39,13 @@ class NewInsertsTest(BaseFramework): ...@@ -22,6 +39,13 @@ class NewInsertsTest(BaseFramework):
def suite(): def suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(NewInsertsTest('checkIsEmpty')) suite.addTest(MinimalNewInsertsTest('checkIsEmpty'))
suite.addTest(NewInsertsTest('checkNewInserts')) suite.addTest(MinimalNewInsertsTest('checkNewInserts'))
suite.addTest(FullNewInsertsTest('checkIsEmpty'))
suite.addTest(FullNewInsertsTest('checkNewInserts'))
return suite return suite
if __name__ == '__main__':
unittest.main(defaultTest='suite')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment