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 os, os.path
import sys import sys
mypath=os.path.split(os.path.abspath(__file__))[0] 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 * from openlp.database.BibleManager import *
bm = BibleManager() class TestBibleManager(unittest.TestCase):
print bm
print bm.getBibles() def setUp(self):
b = bm.getBibles() self.bm = BibleManager()
for b1 in b:
print b1 def testGetBibles(self):
print bm.getBibleBooks("NIV") # make sure the shuffled sequence does not lose any elements
c = bm.getBibleBooks("NIV") b = self.bm.getBibles()
for c1 in c: for b1 in b:
print c1 print b1
print bm.getBookVerseCount("NIV", "GEN", 1) self.assert_(b1 in b)
print bm.getVerseText("NIV", "GEN",1,1,1)
c = bm.getVerseText("NIV","GEN",1,2,1) def testGetBooks(self):
for c1 in c: c = self.bm.getBibleBooks("NIV")
print c1 for c1 in c:
print c1
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()