def test_get_case_form_returns_correct_values(): word = Word(u"dzień", "m inan") word.set_case_forms( "singular", {"nominative": "dzień", "instrumental": "dniem"}) word.set_case_forms("plural", {"nominative": "dni", "locative": "dniach"}) assert word.get_case_form("singular", "nominative") == "dzień" assert word.get_case_form("plural", "nominative") == "dni" assert word.get_case_form("plural", "locative") == "dniach"
def test_clear_case_forms_functions_as_advertised(): word = Word(u"dzień", "m inan") word.set_case_forms( "singular", {"nominative": "dzień", "instrumental": "dniem"}) word.set_case_forms("plural", {"nominative": "dni", "locative": "dniach"}) assert word.get_case_form("singular", "nominative") == "dzień" assert word.get_case_form("plural", "nominative") == "dni" assert word.get_case_form("plural", "locative") == "dniach" word.clear_case_forms() assert not word.supports("singular", "nominative") assert not word.supports("plural", "nominative") assert not word.supports("plural", "locative")
def test_set_case_forms_overwrites_all_for_specific_number(): word = Word(u"dzień", "m inan") word.set_case_forms( "singular", {"nominative": "dzień", "instrumental": "dniem"}) word.set_case_forms("plural", {"nominative": "dni", "locative": "dniach"}) # Overwrite the values for singular word.set_case_forms( "singular", {"nominative": "something", "vocative": "else"}) assert not word.supports("singular", "instrumental") assert word.get_case_form("singular", "nominative") == "something" assert word.get_case_form("singular", "vocative") == "else" assert word.get_case_form("plural", "nominative") == "dni" assert word.get_case_form("plural", "locative") == "dniach"
def test_get_case_form_throws_error_for_non_supported_forms(): word = Word(u"dzień", "m inan") with pytest.raises(CaseNotSupported): word.get_case_form("singular", "nominative")
def test_get_case_form_throws_error_for_non_supported_forms(): word = Word(u"dzień", "m inan") word.get_case_form("singular", "nominative")