def test_latin_e_i_closer_before_vowel(self): """Test the Word class's `_e_i_closer_before_vowel` in Latin.""" condition_1 = lat.Word("gaɫlɪa", lat.LATIN["Classical"]["Allen"]) condition_1._refresh() condition_1._e_i_closer_before_vowel() condition_2 = lat.Word("mɛa", lat.LATIN["Classical"]["Allen"]) condition_2._refresh() condition_2._e_i_closer_before_vowel() outputs = [ "".join([p.ipa for p in condition_1.phones]), "".join([p.ipa for p in condition_2.phones]), ] target = [unicodedata.normalize("NFC", y) for y in ["gaɫlɪ̣a", "mɛ̣a"]] self.assertEqual(outputs, target)
def test_latin_j_z_doubling(self): """Test the Word class's method `_j_z_doubling` in Latin.""" condition_1 = lat.Word("t̪roːjaj", lat.LATIN["Classical"]["Allen"]) condition_1._refresh() condition_1._j_z_doubling() condition_2 = lat.Word("amaːzɔn", lat.LATIN["Classical"]["Allen"]) condition_2._refresh() condition_2._j_z_doubling() outputs = [ "".join([p.ipa for p in condition_1.phones]), "".join([p.ipa for p in condition_2.phones]), ] target = [unicodedata.normalize("NFC", y) for y in ["t̪roːjjaj", "amaːzzɔn"]] self.assertEqual(outputs, target)
def test_latin_ns_nf_lengthening(self): """Test the Word class's method `_ns_nf_lengthening` in Latin.""" condition_1 = lat.Word("kɔn̪sɔl", lat.LATIN["Classical"]["Allen"]) condition_1._refresh() condition_1._ns_nf_lengthening() condition_2 = lat.Word("kɔn̪fɛkiː", lat.LATIN["Classical"]["Allen"]) condition_2._refresh() condition_2._ns_nf_lengthening() outputs = [ "".join([p.ipa for p in condition_1.phones]), "".join([p.ipa for p in condition_2.phones]), ] target = [unicodedata.normalize("NFC", y) for y in ["kɔːn̪sɔl", "kɔːn̪fɛkiː"]] self.assertEqual(outputs, target)
def test_latin_l_darken(self): """Test the Word class's method `_l_darken` in Latin.""" condition_1 = lat.Word("bɛlgaj", lat.LATIN["Classical"]["Allen"]) condition_1._refresh() condition_1._l_darken() condition_2 = lat.Word("kɔːn̪sɔl", lat.LATIN["Classical"]["Allen"]) condition_2._refresh() condition_2._l_darken() outputs = [ "".join([p.ipa for p in condition_1.phones]), "".join([p.ipa for p in condition_2.phones]), ] target = [unicodedata.normalize("NFC", y) for y in ["bɛɫgaj", "kɔːn̪sɔɫ"]] self.assertEqual(outputs, target)
def test_latin_b_devoice(self): """Test the Word class's method `_b_devoice` in Latin.""" condition_1 = lat.Word("abs", lat.LATIN["Classical"]["Allen"]) condition_1._refresh() condition_1._b_devoice() condition_2 = lat.Word("sʊbt̪ʊs", lat.LATIN["Classical"]["Allen"]) condition_2._refresh() condition_2._b_devoice() outputs = [ "".join([p.ipa for p in condition_1.phones]), "".join([p.ipa for p in condition_2.phones]), ] target = [unicodedata.normalize("NFC", y) for y in ["aps", "sʊpt̪ʊs"]] self.assertEqual(outputs, target)
def test_latin_print_ipa(self): """Test the Word class's method `_print_ipa` in Latin.""" inputs = [ lat.Word(w, lat.LATIN["Classical"]["Allen"]) for w in ["gaɫlɪ̣ja", "d̪iːwiːsa"] ] output = [ [ w._print_ipa(syllabify=False, accentuate=False), w._print_ipa(syllabify=True, accentuate=False), w._print_ipa(syllabify=True, accentuate=True), ] for w in inputs ] target = [ [ unicodedata.normalize("NFC", x) for x in ["gaɫlɪ̣ja", "gaɫ.lɪ̣.ja", "'gaɫ.lɪ̣.ja"] ], [ unicodedata.normalize("NFC", x) for x in ["d̪iːwiːsa", "d̪iː.wiː.sa", "d̪iː.'wiː.sa"] ], ] self.assertEqual(output, target)
def test_latin_intervocalic_j(self): """Test the Word class's method `_intervocalic_j` in Latin.""" condition = lat.Word("gaɫlɪ̣a", lat.LATIN["Classical"]["Allen"]) condition._refresh() condition._intervocalic_j() outputs = "".join([p.ipa for p in condition.phones]) target = unicodedata.normalize("NFC", "gaɫlɪ̣ja") self.assertEqual(outputs, target)
def test_latin_g_n_nasality_assimilation(self): """Test the Word class's `_g_n_nasality_assimilation` in Latin.""" condition = lat.Word("magn̪ʊs", lat.LATIN["Classical"]["Allen"]) condition._refresh() condition._g_n_nasality_assimilation() output = "".join([p.ipa for p in condition.phones]) target = unicodedata.normalize("NFC", "maŋn̪ʊs") self.assertEqual(output, target)
def test_latin_n_place_assimilation(self): """Test the Word class's method `_n_place_assimilation` in Latin.""" condition = lat.Word("lɪn̪gʷa", lat.LATIN["Classical"]["Allen"]) condition._refresh() condition._n_place_assimilation() output = "".join([p.ipa for p in condition.phones]) target = unicodedata.normalize("NFC", "lɪŋgʷa") self.assertEqual(output, target)
def test_latin_final_m_drop(self): """Test the Word class's method `_final_m_drop` in Latin.""" condition = lat.Word("kʷaːrum", lat.LATIN["Classical"]["Allen"]) condition._refresh() condition._final_m_drop() output = "".join([p.ipa for p in condition.phones]) target = unicodedata.normalize("NFC", "kʷaːrũː") self.assertEqual(output, target)
def test_latin_uj_diph_maker(self): """Test the Word class's method `_uj_diph_maker` in Latin.""" condition = lat.Word("kʊɪ", lat.LATIN["Classical"]["Allen"]) condition._refresh() condition._uj_diph_maker() output = "".join([p.ipa for p in condition.phones]) target = unicodedata.normalize("NFC", "kuj") self.assertEqual(output, target)
def test_latin_wj_block(self): """Test the Word class's method `_wj_maker` in Latin.""" condition = lat.Word("wjrʊmkʷɛ", lat.LATIN["Classical"]["Allen"]) condition._refresh() condition._wj_block() output = "".join([p.ipa for p in condition.phones]) target = unicodedata.normalize("NFC", "wɪrʊmkʷɛ") self.assertEqual(output, target)
def test_latin_alternate(self): """Test the Word class's method `_alternate` in Latin.""" raw_inputs = ["gallɪa", "d̪iːʊiːsa", "kʷaːrʊm"] outputs = [] for i in raw_inputs: w = lat.Word(i, lat.LATIN["Classical"]["Allen"]) w._alternate() outputs.append("".join([p.ipa for p in w.phones])) target = [ unicodedata.normalize("NFC", y) for y in ["gaɫlɪ̣ja", "d̪iːwiːsa", "kʷaːrũː"] ] self.assertEqual(outputs, target)
def test_latin_long_vowel_catcher(self): """Test the Word class's method `_long_vowel_catcher` in Latin.""" conditions = [ lat.Word(s, lat.LATIN["Classical"]["Allen"]) for s in ["ɪː", "ʊː", "ɛː", "ɪ̃ː", "ʊ̃ː", "ɛ̃ː"] ] for w in conditions: w._long_vowel_catcher() outputs = ["".join([p.ipa for p in c.phones]) for c in conditions] target = [ unicodedata.normalize("NFC", y) for y in ["iː", "uː", "eː", "ĩː", "ũː", "ẽː"] ] self.assertEqual(outputs, target)
def test_latin_refresh(self): """Test the Word class's `_refresh` method in Latin.""" test_word = lat.Word("ɔmn̪ɪs", lat.LATIN["Classical"]["Allen"]) test_word._refresh() contexts = [ test_word.phones[0].left.ipa, test_word.phones[1].left.ipa, test_word.phones[1].right.ipa, test_word.phones[-1].right.ipa, ] target = [ grc.Phone("#").ipa, grc.Phone("ɔ").ipa, grc.Phone("n̪").ipa, grc.Phone("#").ipa, ] self.assertEqual(contexts, target)
def test_latin_syllabify(self): """Test the Word class's `_syllabify` in Latin.""" raw_inputs = ["arma", "kan̪oː", "t̪roːjjaj", "gaɫlɪ̣ja"] outputs = [] for i in raw_inputs: w = lat.Word(i, lat.LATIN["Classical"]["Allen"]) w._syllabify() outputs.append( ["".join([p.ipa for l in n for p in l]) for n in w._syllabify()] ) target = [ [unicodedata.normalize("NFC", s) for s in y] for y in [ ["ar", "ma"], ["ka", "n̪oː"], ["t̪roːj", "jaj"], ["gaɫ", "lɪ̣", "ja"], ] ] self.assertEqual(outputs, target)