Exemple #1
0
class TestHoroReport(unittest.TestCase):

	def setUp(self):
		self.report = HoroReport()
		self.input = HoroInput()
		self.input.load('input.xlsx')
		content = [['Section']]
		self.report.loadDataSource('AstroReport_Content.xlsx')
		self.content = self.report.loadContentUsing(self.input.getReport('Sheet1'))

	def testSanity(self):
		self.assertEqual(2, len(self.content))

	def testLoadSectionCorrectly(self):
		self.assertEqual(u'Tình yêu', self.content[0]['section_title'])

	def testLoadParagraph(self):
		paragraphs = self.content[0]['paragraph']
		self.assertEqual(3, len(paragraphs))
		self.assertEqual(u'Cung Mọc ở Bạch Dương', paragraphs[0]['title'])

	def testLoadNonExistParagraph(self):
		paragraph = self.report.getParagraphFromSource('1.1', '1.3')
		self.assertEqual('Cannot found', paragraph['title'])

	def testLoadNonExistSheet(self):
		paragraph = self.report.getParagraphFromSource('1111', '1,3')
		self.assertEqual('Cannot found', paragraph['title'])
Exemple #2
0
	def testIntegrationGen(self):
		input = HoroInput()
		input.load('sample.xlsx')
		report = HoroReport()
		report.loadDataSource('AstroReport_Content.xlsx')
		content = report.loadContentUsing(input.getReport('Sheet1'))
		doc = HoroDocument()
		doc.generate(content)
		doc.save('sample.docx')
Exemple #3
0
	def setUp(self):
		self.report = HoroReport()
		self.input = HoroInput()
		self.input.load('input.xlsx')
		content = [['Section']]
		self.report.loadDataSource('AstroReport_Content.xlsx')
		self.content = self.report.loadContentUsing(self.input.getReport('Sheet1'))