def test_unicode(self): self.assertEqual(remove_latex_braces( 'th{í}s is a Test'), 'thís is a Test') self.assertEqual(remove_latex_braces( '{t}hís is a Test'), 'thís is a Test') self.assertEqual(remove_latex_braces( 'thís {is} a Test'), 'thís is a Test')
def test_simple(self): self.assertEqual(remove_latex_braces( 'this is a test'), 'this is a test') self.assertEqual(remove_latex_braces( 'this is a {Test}'), 'this is a Test') self.assertEqual(remove_latex_braces( 'this {is} a Test'), 'this is a Test') self.assertEqual(remove_latex_braces( '{this} is a Test'), 'this is a Test') self.assertEqual(remove_latex_braces( '{this is a Test}'), 'this is a Test')
def test_remove_latex_braces(self): self.assertEqual(remove_latex_braces('Th{é}odore'), 'Th\xe9odore') self.assertEqual(remove_latex_braces('the {CADE} conference'), 'the CADE conference') self.assertEqual(remove_latex_braces('consider 2^{a+b}'), 'consider 2^{a+b}') self.assertEqual(remove_latex_braces('{why these braces?}'), 'why these braces?')
def test_multiple(self): self.assertEqual(remove_latex_braces('J{é}r{é}mie'), 'Jérémie')
def test_command(self): self.assertEqual(remove_latex_braces( 'in \\mathbb{R} let'), 'in \\mathbb{R} let') self.assertEqual(remove_latex_braces( 'in \\emph{blue} let'), 'in \\emph{blue} let')
def test_math(self): self.assertEqual(remove_latex_braces( 'base^{superscript}_{subscript}'), 'base^{superscript}_{subscript}')
def parse_authors_list(authors): authors = unescape_latex(authors) authors = et_al_re.sub('', authors) return map(parse_comma_name, remove_latex_braces(unescape_latex(authors)).split(' and '))