def test_format_restrictions(self): entry = LexicalEntry() entry.set_restriction("strict_ver", language="ver") entry.set_restriction("strict_eng", language="eng") entry.set_restriction("strict_nat", language="nat") entry.set_restriction("strict_reg", language="reg") expected = "\\textit{VerRestrict:} \\textbf{\ipa{strict_ver}} \\textit{Restrict:} strict_eng \\textit{\\textit{\zh{strict_nat}}} \\textit{[\ipa{strict_reg}]} " self.assertEqual(format_restrictions(entry.get_senses()[0], font), expected) del entry
def test_format_encyclopedic_informations(self): entry = LexicalEntry() entry.set_encyclopedic_information("info_ver", language="ver") entry.set_encyclopedic_information("info_eng", language="eng") entry.set_encyclopedic_information("info_nat", language="nat") entry.set_encyclopedic_information("info_reg", language="reg") expected = "\\textbf{\ipa{info_ver}} info_eng \\textit{\zh{info_nat}} \\textit{[\ipa{info_reg}]} " self.assertEqual(format_encyclopedic_informations(entry.get_senses()[0], font), expected) del entry
def test_format_usage_notes(self): entry = LexicalEntry() entry.set_usage_note("use_ver", language="ver") entry.set_usage_note("use_eng", language="eng") entry.set_usage_note("use_nat", language="nat") entry.set_usage_note("use_reg", language="reg") expected = "\\textit{VerUsage:} \\textbf{\ipa{use_ver}} \\textit{Usage:} use_eng \\textit{\\textit{\zh{use_nat}}} \\textit{[\ipa{use_reg}]} " self.assertEqual(format_usage_notes(entry.get_senses()[0], font), expected) del entry
def test_format_examples(self): entry = LexicalEntry() entry.add_example("ex_ver", language="ver") entry.add_example("ex_eng", language="eng") entry.add_example("ex_nat", language="nat") entry.add_example("ex_reg", language="reg") expected = "\\begin{exe}\n\\sn \\textbf{\ipa{ex_ver}}\n\\trans ex_eng\n\\trans \\textit{\\textit{\zh{ex_nat}}}\n\\trans \\textit{[\ipa{ex_reg}]}\n\\end{exe}\n" self.assertEqual(format_examples(entry.get_senses()[0], font), expected) del entry
def test_format_encyclopedic_informations(self): entry = LexicalEntry() entry.set_encyclopedic_information("info_ver", language="ver") entry.set_encyclopedic_information("info_eng", language="eng") entry.set_encyclopedic_information("info_nat", language="nat") entry.set_encyclopedic_information("info_reg", language="reg") expected = "\\textbf{\ipa{info_ver}} info_eng \\textit{\zh{info_nat}} \\textit{[\ipa{info_reg}]} " self.assertEqual( format_encyclopedic_informations(entry.get_senses()[0], font), expected) del entry
def test_format_definitions(self): entry = LexicalEntry() entry.set_definition("def_ver", language="ver") entry.set_definition("def_nat", language="nat") entry.set_definition("def_eng", language="eng") entry.set_gloss("gloss_ver", language="ver") entry.set_gloss("gloss_nat", language="nat") entry.set_gloss("gloss_eng", language="eng") entry.set_gloss("gloss_reg", language="reg") entry.set_translation("trans_ver", language="ver") entry.set_translation("trans_nat", language="nat") entry.set_translation("trans_eng", language="eng") entry.set_translation("trans_reg", language="reg") # vernacular expected = "\\textbf{\ipa{def_ver}}. trans_ver. " # English expected += "def_eng. trans_eng. " # national expected += "\\textit{\zh{def_nat}}. \\textit{\zh{trans_nat}}. " # regional expected += "\\textit{[Regnl: \ipa{gloss_reg}]}. \\textbf{rr:}\\textit{[Regnl: trans_reg]}. " self.assertEqual(format_definitions(entry.get_senses()[0], font), expected) del entry