def testMinimalExample(self):
     file_ = os.path.abspath(os.path.join('..','testFiles','minimalExample.tex'))
     sArgs = sortArgs([])
     repRE, extRE, puncRE, delRE = compileRegex(sArgs[0], sArgs[1], sArgs[3],
                                        sArgs[4], sArgs[2])
     text = extractText(file_, repRE, extRE, puncRE, delRE)
     self.assertEqual(text, "")
 def testSampleOneReplaceClass(self):
     file_ = os.path.abspath(os.path.join('..','testFiles','example1.tex'))
     sArgs = sortArgs(["--replace-class","hword","Header"])
     repRE, extRE, puncRE, delRE = compileRegex(sArgs[0], sArgs[1], sArgs[3],
                                        sArgs[4], sArgs[2])
     text = extractText(file_, repRE, extRE, puncRE, delRE)
     self.assertEqual(text, "Header Header Header This is a sample document to test expected extraction."+\
                      " Header Header Header This is section one. Header Header This is section two.")
 def testSampleOneIgnoreDefault(self):
     file_ = os.path.abspath(os.path.join('..','testFiles','example1.tex'))
     sArgs = sortArgs(["--ignore-default-extraction","--extract-class","word"])
     repRE, extRE, puncRE, delRE = compileRegex(sArgs[0], sArgs[1], sArgs[3],
                                        sArgs[4], sArgs[2])
     text = extractText(file_, repRE, extRE, puncRE, delRE)
     self.assertEqual(text, "This is a sample document to test expected extraction."+\
                      " This is section one. This is section two.")
 def testSampleOneNoPunc(self):
     file_ = os.path.abspath(os.path.join('..','testFiles','example1.tex'))
     sArgs = sortArgs(["--no-punctuation"])
     repRE, extRE, puncRE, delRE = compileRegex(sArgs[0], sArgs[1], sArgs[3],
                                        sArgs[4], sArgs[2])
     text = extractText(file_, repRE, extRE, puncRE, delRE)
     self.assertEqual(text, "Sample Article One This is a sample document to test expected extraction"+\
                      " Section One Title This is section one Section Two This is section two")
Esempio n. 5
0
 def testMinimalExample(self):
     file_ = os.path.abspath(
         os.path.join('..', 'testFiles', 'minimalExample.tex'))
     sArgs = sortArgs([])
     repRE, extRE, puncRE, delRE = compileRegex(sArgs[0], sArgs[1],
                                                sArgs[3], sArgs[4],
                                                sArgs[2])
     text = extractText(file_, repRE, extRE, puncRE, delRE)
     self.assertEqual(text, "")
 def testSample2ReplaceInlineMath(self):
     file_ = os.path.abspath(os.path.join('..','testFiles','example2.tex'))
     sArgs = sortArgs(["--replace-inline-math","inline_math"])
     repRE, extRE, puncRE, delRE = compileRegex(sArgs[0], sArgs[1], sArgs[3],
                                        sArgs[4], sArgs[2])
     text = extractText(file_, repRE, extRE, puncRE, delRE)
     self.assertEqual(text, "Sample Article Two This is a sample document to test expected extraction."+\
                      " Section One Title This is section one. This is an inline equation inline_math with text surrounding it."+\
                      " This is a normal equation This is a figure")
Esempio n. 7
0
 def testSampleOneReplaceClass(self):
     file_ = os.path.abspath(os.path.join('..', 'testFiles',
                                          'example1.tex'))
     sArgs = sortArgs(["--replace-class", "hword", "Header"])
     repRE, extRE, puncRE, delRE = compileRegex(sArgs[0], sArgs[1],
                                                sArgs[3], sArgs[4],
                                                sArgs[2])
     text = extractText(file_, repRE, extRE, puncRE, delRE)
     self.assertEqual(text, "Header Header Header This is a sample document to test expected extraction."+\
                      " Header Header Header This is section one. Header Header This is section two.")
Esempio n. 8
0
 def testSampleOneNoPunc(self):
     file_ = os.path.abspath(os.path.join('..', 'testFiles',
                                          'example1.tex'))
     sArgs = sortArgs(["--no-punctuation"])
     repRE, extRE, puncRE, delRE = compileRegex(sArgs[0], sArgs[1],
                                                sArgs[3], sArgs[4],
                                                sArgs[2])
     text = extractText(file_, repRE, extRE, puncRE, delRE)
     self.assertEqual(text, "Sample Article One This is a sample document to test expected extraction"+\
                      " Section One Title This is section one Section Two This is section two")
 def testSample2PuncFile(self):
     file_ = os.path.abspath(os.path.join('..','testFiles','example2.tex'))
     pFile = os.path.abspath(os.path.join('..','testFiles','samplePuncFile.txt'))
     sArgs = sortArgs(["--punctuation-file",pFile])
     repRE, extRE, puncRE, delRE = compileRegex(sArgs[0], sArgs[1], sArgs[3],
                                        sArgs[4], sArgs[2])
     text = extractText(file_, repRE, extRE, puncRE, delRE)
     self.assertEqual(text, "Sample Article Two This is a sample document to test expected extraction."+\
                      " Section One Title This is section one. This is an inline equation with text surrounding it."+\
                      " This is a normal equation This is a figure:")
Esempio n. 10
0
 def testSample2ReplaceInlineMath(self):
     file_ = os.path.abspath(os.path.join('..', 'testFiles',
                                          'example2.tex'))
     sArgs = sortArgs(["--replace-inline-math", "inline_math"])
     repRE, extRE, puncRE, delRE = compileRegex(sArgs[0], sArgs[1],
                                                sArgs[3], sArgs[4],
                                                sArgs[2])
     text = extractText(file_, repRE, extRE, puncRE, delRE)
     self.assertEqual(text, "Sample Article Two This is a sample document to test expected extraction."+\
                      " Section One Title This is section one. This is an inline equation inline_math with text surrounding it."+\
                      " This is a normal equation This is a figure")
Esempio n. 11
0
 def testSampleOneIgnoreDefault(self):
     file_ = os.path.abspath(os.path.join('..', 'testFiles',
                                          'example1.tex'))
     sArgs = sortArgs(
         ["--ignore-default-extraction", "--extract-class", "word"])
     repRE, extRE, puncRE, delRE = compileRegex(sArgs[0], sArgs[1],
                                                sArgs[3], sArgs[4],
                                                sArgs[2])
     text = extractText(file_, repRE, extRE, puncRE, delRE)
     self.assertEqual(text, "This is a sample document to test expected extraction."+\
                      " This is section one. This is section two.")
Esempio n. 12
0
 def testSample2PuncFile(self):
     file_ = os.path.abspath(os.path.join('..', 'testFiles',
                                          'example2.tex'))
     pFile = os.path.abspath(
         os.path.join('..', 'testFiles', 'samplePuncFile.txt'))
     sArgs = sortArgs(["--punctuation-file", pFile])
     repRE, extRE, puncRE, delRE = compileRegex(sArgs[0], sArgs[1],
                                                sArgs[3], sArgs[4],
                                                sArgs[2])
     text = extractText(file_, repRE, extRE, puncRE, delRE)
     self.assertEqual(text, "Sample Article Two This is a sample document to test expected extraction."+\
                      " Section One Title This is section one. This is an inline equation with text surrounding it."+\
                      " This is a normal equation This is a figure:")