Exemplo n.º 1
0
def test_readme_example_2():

    adv = pluralize_advanced("album")

    # the plural
    assert adv.plural == 'albums'

    # what the algorithm (without Hunspell) created
    # is probably not correct, that's why Hunspell is
    # used on it. It is like a preprocessing:
    assert adv.algorithmic_plural == 'alba'

    # indicates that end result was found in Hunspell
    adv.hunspell_spelled = True

    # the plural was found by replacement of
    # 'a' to 'ums'
    assert adv.switched_ending_from == 'a'
    assert adv.switched_ending_to == 'ums'

    # suggestions given by Hunspell when the algorithmic
    # result was processed:
    assert adv.suggestions == ('Alba', 'aba', 'balba', 'albe', 'alia', 'alla',
                               'alma', 'alfa', 'Elba')
def test_p_hijsen():
    result = pluralize_advanced("hijs")
    #pprint(vars(result))
    assert result.algorithmic_plural != result.plural
    assert result.switched_ending_from == "zen"
    assert result.switched_ending_to == "sen"
def test_p_wenkbrauwgel():

    result = pluralize_advanced("wenkbrauwgel")
    #pprint(vars(result))
    assert result.algorithmic_plural != result.plural
    assert result.algorithmic_plural == "wenkbrauwgels"
def pluralize_advanced_algo_result(str: str) -> str:
    return pluralize_advanced(str).algorithmic_plural
def test_p_oogpotlood():
    result = pluralize_advanced("oogpotlood")
    assert result.algorithmic_plural != result.plural
    assert result.algorithmic_plural == "oogpotloden"
def test_p_cursus():
    result = pluralize_advanced("cursus")
    #pprint(vars(result))
    assert result.algorithmic_plural != result.plural
    assert result.switched_ending_from == "i"
    assert result.switched_ending_to == "ussen"
def test_p_album():
    result = pluralize_advanced("album")
    #pprint(vars(result))
    assert result.algorithmic_plural != result.plural
    assert result.switched_ending_from == "a"
    assert result.switched_ending_to == "ums"
def test_p_drie():
    result = pluralize_advanced("drie")
    #pprint(vars(result))
    assert result.algorithmic_plural != result.plural
    assert result.switched_ending_from == "iën"
    assert result.switched_ending_to == "ieën"
def test_p_snede():
    result = pluralize_advanced("snede")
    #pprint(vars(result))
    assert result.algorithmic_plural != result.plural
    assert result.switched_ending_from == "des"
    assert result.switched_ending_to == "den"