Proper Unitest this time

bzr-revno: 33
This commit is contained in:
Tim Bentley 2008-10-23 17:07:53 +00:00
parent fc913785b9
commit 681aa1d141

View File

@ -1,3 +1,6 @@
import random
import unittest
import os, os.path
import sys
mypath=os.path.split(os.path.abspath(__file__))[0]
@ -5,18 +8,32 @@ sys.path.insert(0,(os.path.join(mypath, '..', '..','..')))
from openlp.database.BibleManager import *
bm = BibleManager()
print bm
print bm.getBibles()
b = bm.getBibles()
class TestBibleManager(unittest.TestCase):
def setUp(self):
self.bm = BibleManager()
def testGetBibles(self):
# make sure the shuffled sequence does not lose any elements
b = self.bm.getBibles()
for b1 in b:
print b1
print bm.getBibleBooks("NIV")
c = bm.getBibleBooks("NIV")
self.assert_(b1 in b)
def testGetBooks(self):
c = self.bm.getBibleBooks("NIV")
for c1 in c:
print c1
print bm.getBookVerseCount("NIV", "GEN", 1)
print bm.getVerseText("NIV", "GEN",1,1,1)
c = bm.getVerseText("NIV","GEN",1,2,1)
self.assert_(c1 in c)
def testGetBooks(self):
self.failUnless(self.bm.getBookVerseCount("NIV", "GEN", 1) == 28, "Wrong Book Count")
def testGetVerseText(self):
c = self.bm.getVerseText("NIV","GEN",1,2,1)
for c1 in c:
print c1
self.assert_(c1 in c)
if __name__ == '__main__':
unittest.main()