Exemplo n.º 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)
Exemplo n.º 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, ".")
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 10
0
	def test_caesar_reads_chapt2_3_4(self):
		#print("")
		tds = TEIDataSource(caesar_gallic)
		text = tds.read_fragment('2.3.4')
Exemplo n.º 11
0
	def test_sallust_reads_chapt1(self):
		#print("")
		tds = TEIDataSource(sallust_cataline)
		text = tds.read_fragment('1')
Exemplo n.º 12
0
	def test_propertius_reads_1_2(self):
		#print("")
		tds = TEIDataSource(propertius)
		text = tds.read_fragment('1.2')
Exemplo n.º 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')
Exemplo n.º 14
0
	def test_junk_cts_fails(self):
		#print("")
		# this is a test document URI
		with self.assertRaises(Exception):
			tds = TEIDataSource(junk_cts)
Exemplo n.º 15
0
	def test_cicero_reads_chapt2_2(self):
		#print("")
		tds = TEIDataSource(cicero_derepublica)
		text = tds.read_fragment('2,2')
		self.assertIsNotNone(text)
Exemplo n.º 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')