Skip to content

Commit

Permalink
Merge pull request #14 from bretttolbert/fix_KeyError_with_abolir
Browse files Browse the repository at this point in the history
fixed KeyError with Spanish verb abolir
  • Loading branch information
bretttolbert authored Dec 14, 2023
2 parents 612a803 + ca346e6 commit 7c7d32e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
18 changes: 18 additions & 0 deletions tests/test_inflector_es.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,31 @@ def test_all_verbs_have_templates():
['yo parecería', 'tú parecerías', 'él parecería', 'nosotros pareceríamos', 'vosotros pareceríais', 'ellos parecerían']),
('parecer', 'indicativo', 'pretérito-perfecto-compuesto',
['yo he parecido', 'tú has parecido', 'él ha parecido', 'nosotros hemos parecido', 'vosotros habéis parecido', 'ellos han parecido']),
('abolir', 'indicativo', 'presente',
['yo abolo', 'tú aboles', 'él abole', 'nosotros abolimos', 'vosotros abolís', 'ellos abolen']),
('abolir', 'subjuntivo', 'futuro',
['yo aboliere', 'tú abolieres', 'él aboliere', 'nosotros aboliéremos', 'vosotros aboliereis', 'ellos abolieren'])
]

@pytest.mark.parametrize("infinitive,mood,tense,expected_result",
test_es_conjugate_mood_tense_data)
def test_inflector_es_conjugate_mood_tense(infinitive, mood, tense, expected_result):
assert cg.conjugate_mood_tense(infinitive, mood, tense) == expected_result

def test_abolir():
"""
Reproduce error:
> co.template.moods[persons_mood_name].tenses[aux_tense_name].person_endings]
E KeyError: 'presente'
../../PyVEnvs/Py311/lib/python3.11/site-packages/verbecc/inflector.py:259: KeyError
Error was occuring because the "<Subvuntivo>" was empty in the "abol:ir" template.
"""
result = cg.conjugate('abolir')
assert result is not None

def test_inflector_es_get_conj_obs():
co = cg._inflector._get_conj_obs('abañar')
assert co.verb.infinitive == "abañar"
Expand Down
34 changes: 33 additions & 1 deletion verbecc/data/conjugations-es.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,38 @@
</futuro>
</Indicativo>
<Subjuntivo>
<presente>
<p><i>a</i></p>
<p><i>as</i></p>
<p><i>a</i></p>
<p><i>amos</i></p>
<p><i>áis</i></p>
<p><i>lan</i></p>
</presente>
<pretérito-imperfecto-1>
<p><i>iera</i></p>
<p><i>ieras</i></p>
<p><i>iera</i></p>
<p><i>iéramos</i></p>
<p><i>ierais</i></p>
<p><i>ieran</i></p>
</pretérito-imperfecto-1>
<pretérito-imperfecto-2>
<p><i>iese</i></p>
<p><i>ieses</i></p>
<p><i>iese</i></p>
<p><i>iésemos</i></p>
<p><i>ieseis</i></p>
<p><i>iesen</i></p>
</pretérito-imperfecto-2>
<futuro>
<p><i>iere</i></p>
<p><i>ieres</i></p>
<p><i>iere</i></p>
<p><i>iéremos</i></p>
<p><i>iereis</i></p>
<p><i>ieren</i></p>
</futuro>
</Subjuntivo>
<Imperativo>
<afirmativo>
Expand Down Expand Up @@ -209,7 +241,7 @@
<p><i>uareis</i></p>
<p><i>uaren</i></p>
</futuro>
</Subjuntivo>
</Subjuntivo>
<Imperativo>
<afirmativo>
<p><i>úa</i></p>
Expand Down

0 comments on commit 7c7d32e

Please sign in to comment.