Example #1
0
	def test_homer_loads(self):
		#print("")
		# this is a test document URI
		tds = TEIDataSource(homer_iliad)
		fo = tds.open_source()
		# #print("Name of the file: ", fo.name)
		# #print("Closed or not : ", fo.closed)
		# #print("Opening mode : ", fo.mode)
		tds.close_source(fo)
Example #2
0
	def test_caesar_reads_metadata(self):
		#print("")
		tds = TEIDataSource(caesar_gallic)
		tds.read_doc_metadata()
		self.assertNotEqual(tds.source_desc, None)
		##print(tds.source_desc)
		i = 0
		for s in tds.sections:
			i += 1
			# #print(str(i) + "=" + s)
		self.assertEqual(i, 3)
		self.assertEqual(tds.delim, ".")
Example #3
0
	def test_sallust_reads_metadata(self):
		#print("")
		tds = TEIDataSource(sallust_cataline)
		tds.read_doc_metadata()
		self.assertNotEqual(tds.source_desc, None)
		# #print(tds.source_desc)
		i = 0
		for s in tds.sections:
			i += 1
			# #print(str(i) + "=" + s)
		self.assertEqual(i, 1)
		self.assertIsNotNone(tds.delim)
		self.assertEquals(',', tds.delim) #default
Example #4
0
	def test_cicero_derepublica_metadata(self):
		#print(cicero_derepublica)
		tds = TEIDataSource(cicero_derepublica)
		tds.read_doc_metadata()
		self.assertIsNotNone(tds.source_desc)
		##print(tds.source_desc)
		i = 0
		for s in tds.sections:
			i += 1
			##print(str(i) + "=" + s)
		self.assertEqual(i, 2)
		self.assertIsNotNone(tds.delim)
		self.assertEquals(',', tds.delim)
 def test_cicero_load(self):
     print("\n======================\n%s" % cicero_derepublica)
     tds = TEIDataSource(cicero_derepublica)
     self.assertIsNotNone(tds.source_desc)
     i = 0
     for s in tds.sections:
         i += 1
         #print(str(i) + "=" + s)
     self.assertEqual(i, 2)
     self.assertEqual(tds.delim, ',')  #default
     self.assertIsNotNone(tds.document_metastructure)
     self.printdetail(tds)
 def test_caesar_load(self):
     print("\n======================\n%s" % caesar_gallic)
     tds = TEIDataSource(caesar_gallic)
     self.assertNotEqual(tds.source_desc, None)
     i = 0
     for s in tds.sections:
         i += 1
         # print(str(i) + "=" + s)
     self.assertEqual(i, 3)
     self.assertEqual(tds.delim, ".")
     self.assertIsNotNone(tds.document_metastructure)
     self.printdetail(tds)
 def test_strabo_load(self):
     print("\n======================\n%s" % strabo_geo)
     tds = TEIDataSource(strabo_geo)
     self.assertNotEqual(tds.source_desc, None)
     i = 0
     for s in tds.sections:
         i += 1
         # print(str(i) + "=" + s)
     self.assertEqual(i, 3)
     #self.assertEqual(tds.delim, ".")
     self.assertIsNotNone(tds.document_metastructure)
     self.assertEqual("Strabo", tds.author)
     self.printdetail(tds)
 def test_sallust_load(self):
     print("\n======================\n%s" % sallust_cataline)
     # this is a test document URI
     tds = TEIDataSource(sallust_cataline)
     self.assertNotEqual(tds.source_desc, None)
     i = 0
     for s in tds.sections:
         i += 1
         # print(str(i) + "=" + s)
     self.assertEqual(i, 1)
     self.assertEqual(tds.delim, ',')  #default
     self.assertIsNotNone(tds.document_metastructure)
     self.printdetail(tds)
 def test_cicero_timaeus_author_title(self):
     print("\n======================\n%s" % cicero_timaeus)
     tds = TEIDataSource(cicero_timaeus)
     self.assertIsNotNone(tds.title)
     self.assertIsNotNone(tds.author)
     self.printdetail(tds)
Example #10
0
	def test_caesar_reads_chapt2_3_4(self):
		#print("")
		tds = TEIDataSource(caesar_gallic)
		text = tds.read_fragment('2.3.4')
Example #11
0
	def test_sallust_reads_chapt1(self):
		#print("")
		tds = TEIDataSource(sallust_cataline)
		text = tds.read_fragment('1')
Example #12
0
	def test_propertius_reads_1_2(self):
		#print("")
		tds = TEIDataSource(propertius)
		text = tds.read_fragment('1.2')
Example #13
0
	def test_homer_unreadable(self):
		#print("")
		tds = TEIDataSource(homer_iliad)
		with self.assertRaises(Exception): #, "No text part with ref: 1"):
			text = tds.read_fragment('1')
Example #14
0
	def test_junk_cts_fails(self):
		#print("")
		# this is a test document URI
		with self.assertRaises(Exception):
			tds = TEIDataSource(junk_cts)
Example #15
0
	def test_cicero_reads_chapt2_2(self):
		#print("")
		tds = TEIDataSource(cicero_derepublica)
		text = tds.read_fragment('2,2')
		self.assertIsNotNone(text)
Example #16
0
	def test_sallust_doesnotread_chapt1000000(self):
		#print("")
		tds = TEIDataSource(sallust_cataline)
		with self.assertRaises(Exception): # "No text part with ref: 1000000"):
			tds.read_fragment('1000000')