+ repl = ICURuleLoader(fpath).get_replacement_pairs()
+
+ assert [(a, sorted(b)) for a, b in repl] == \
+ [(' sainte ', [' sainte ', ' st ']),
+ (' saint ', [' saint ', ' st '])]
+
+
+def test_get_replacement_pairs_cross_abbreviations(cfgfile):
+ fpath = cfgfile([], ['saint,Sainte => st',
+ 'sainte => ste'])
+
+ repl = ICURuleLoader(fpath).get_replacement_pairs()
+
+ assert [(a, sorted(b)) for a, b in repl] == \
+ [(' sainte ', [' sainte ', ' st ', ' ste ']),
+ (' saint ', [' saint ', ' st '])]
+
+
+@pytest.mark.parametrize("abbr", ["missing to =>",
+ " => missing from",
+ "=>"])
+def test_bad_abbreviation_syntax(tmp_path, abbr):
+ fpath = tmp_path / ('test_config.yaml')
+ fpath.write_text(dedent("""\
+ normalization:
+ transliteration:
+ compound_suffixes:
+ abbreviations:
+ - {}
+ """.format(abbr)))