jaraco / inflect

Correctly generate plurals, ordinals, indefinite articles; convert numbers to words
https://pypi.org/project/inflect
MIT License
957 stars 107 forks source link

7.2.0 failing tests #208

Closed dvzrv closed 4 months ago

dvzrv commented 5 months ago

Hi! When upgrading the package on Arch Linux to 7.2.0 I ran into four failing tests:

========================== short test summary info ============================
FAILED tests/test_inflections.py::test_many - AssertionError: assert 'pairs o...
FAILED tests/test_pwd.py::Test::test_pl - pydantic_core._pydantic_core.Valida...
FAILED tests/test_pwd.py::Test::test__pl_special_verb - pydantic_core._pydant...
FAILED tests/test_pwd.py::Test::test_a_alt - pydantic_core._pydantic_core.Val...
================== 4 failed, 202 passed, 16 xfailed in 0.88s ===================

python-inflect-7.2.0-1-x86_64-build.log python-inflect-7.2.0-1-x86_64-check.log

jaraco commented 4 months ago
``` ============================= test session starts ============================== platform linux -- Python 3.11.8, pytest-8.1.1, pluggy-1.4.0 -- /usr/bin/python cachedir: .pytest_cache rootdir: /build/python-inflect/src/inflect-7.2.0 configfile: pytest.ini plugins: typeguard-4.2.0, enabler-3.1.1 collecting ... collected 222 items tests/test_an.py::test_an PASSED [ 0%] tests/test_an.py::test_an_abbreviation PASSED [ 0%] tests/test_classical_all.py::Test::test_classical PASSED [ 1%] tests/test_classical_ancient.py::test_ancient_1 PASSED [ 1%] tests/test_classical_herd.py::test_ancient_1 PASSED [ 2%] tests/test_classical_names.py::test_ancient_1 PASSED [ 2%] tests/test_classical_person.py::test_ancient_1 PASSED [ 3%] tests/test_classical_zero.py::test_ancient_1 PASSED [ 3%] tests/test_compounds.py::test_compound_1 PASSED [ 4%] tests/test_compounds.py::test_compound_2 PASSED [ 4%] tests/test_compounds.py::test_compound_3 PASSED [ 4%] tests/test_compounds.py::test_compound_4 PASSED [ 5%] tests/test_compounds.py::test_unit_handling_degree PASSED [ 5%] tests/test_compounds.py::test_unit_handling_fractional PASSED [ 6%] tests/test_compounds.py::test_unit_handling_combined PASSED [ 6%] tests/test_compounds.py::test_unit_open_compound_nouns PASSED [ 7%] tests/test_compounds.py::test_unit_open_compound_nouns_classical PASSED [ 7%] tests/test_inflections.py::test_many FAILED [ 8%] tests/test_inflections.py::test_def PASSED [ 8%] tests/test_inflections.py::test_ordinal PASSED [ 9%] tests/test_inflections.py::test_decimal_ordinals PASSED [ 9%] tests/test_inflections.py::test_prespart PASSED [ 9%] tests/test_inflections.py::test_inflect_on_tuples PASSED [ 10%] tests/test_inflections.py::test_inflect_on_builtin_constants PASSED [ 10%] tests/test_inflections.py::test_inflect_keyword_args PASSED [ 11%] tests/test_inflections.py::test_NameError_in_strings PASSED [ 11%] tests/test_join.py::test_join PASSED [ 12%] tests/test_numwords.py::test_loop PASSED [ 12%] tests/test_numwords.py::test_lines PASSED [ 13%] tests/test_numwords.py::test_array PASSED [ 13%] tests/test_numwords.py::test_issue_131 PASSED [ 13%] tests/test_pl_si.py::test_pl_si[classical off-Times] PASSED [ 14%] tests/test_pl_si.py::test_pl_si[classical off-Jones] PASSED [ 14%] tests/test_pl_si.py::test_pl_si[classical on-Times] PASSED [ 15%] tests/test_pl_si.py::test_pl_si[classical on-Jones] PASSED [ 15%] tests/test_pwd.py::Test::test_enclose PASSED [ 16%] tests/test_pwd.py::Test::test_joinstem PASSED [ 16%] tests/test_pwd.py::Test::test_classical PASSED [ 17%] tests/test_pwd.py::Test::test_num PASSED [ 17%] tests/test_pwd.py::Test::test_inflect PASSED [ 18%] tests/test_pwd.py::Test::test_user_input_fns PASSED [ 18%] tests/test_pwd.py::Test::test_user_input_defverb PASSED [ 18%] tests/test_pwd.py::Test::test_user_input_defverb_compare XFAIL (todo) [ 19%] tests/test_pwd.py::Test::test_postprocess PASSED [ 19%] tests/test_pwd.py::Test::test_partition_word PASSED [ 20%] tests/test_pwd.py::Test::test_pl FAILED [ 20%] tests/test_pwd.py::Test::test_sinoun PASSED [ 21%] tests/test_pwd.py::Test::test_gender PASSED [ 21%] tests/test_pwd.py::Test::test_compare_simple[index-index-eq] PASSED [ 22%] tests/test_pwd.py::Test::test_compare_simple[index-indexes-s:p] PASSED [ 22%] tests/test_pwd.py::Test::test_compare_simple[index-indices-s:p] PASSED [ 22%] tests/test_pwd.py::Test::test_compare_simple[indexes-index-p:s] PASSED [ 23%] tests/test_pwd.py::Test::test_compare_simple[indices-index-p:s] PASSED [ 23%] tests/test_pwd.py::Test::test_compare_simple[indices-indexes-p:p] PASSED [ 24%] tests/test_pwd.py::Test::test_compare_simple[indexes-indices-p:p] PASSED [ 24%] tests/test_pwd.py::Test::test_compare_simple[indices-indices-eq] PASSED [ 25%] tests/test_pwd.py::Test::test_compare_simple[inverted index-inverted indices-s:p] PASSED [ 25%] tests/test_pwd.py::Test::test_compare_simple[inverted indices-inverted index-p:s] PASSED [ 26%] tests/test_pwd.py::Test::test_compare_simple[inverted indexes-inverted indices-p:p] PASSED [ 26%] tests/test_pwd.py::Test::test_compare_simple[opuses-opera-p:p] PASSED [ 27%] tests/test_pwd.py::Test::test_compare_simple[opera-opuses-p:p] PASSED [ 27%] tests/test_pwd.py::Test::test_compare_simple[brothers-brethren-p:p] PASSED [ 27%] tests/test_pwd.py::Test::test_compare_simple[cats-cats-eq] PASSED [ 28%] tests/test_pwd.py::Test::test_compare_simple[base-basis-False] PASSED [ 28%] tests/test_pwd.py::Test::test_compare_simple[syrinx-syringe-False] PASSED [ 29%] tests/test_pwd.py::Test::test_compare_simple[she-he-False] PASSED [ 29%] tests/test_pwd.py::Test::test_compare_simple[opus-operas-False] PASSED [ 30%] tests/test_pwd.py::Test::test_compare_simple[taxi-taxes-False] PASSED [ 30%] tests/test_pwd.py::Test::test_compare_simple[time-Times-False] PASSED [ 31%] tests/test_pwd.py::Test::test_compare_simple[time-times-s:p] PASSED [ 31%] tests/test_pwd.py::Test::test_compare_simple[courts martial-court martial-p:s] PASSED [ 31%] tests/test_pwd.py::Test::test_compare_simple[my-my-eq] PASSED [ 32%] tests/test_pwd.py::Test::test_compare_simple[my-our-s:p] PASSED [ 32%] tests/test_pwd.py::Test::test_compare_simple[our-our-eq] PASSED [ 33%] tests/test_pwd.py::Test::test_compare_simple[dresses's-dresses'-p:p] XFAIL [ 33%] tests/test_pwd.py::Test::test_compare_simple[dress's-dress'-s:s] XFAIL [ 34%] tests/test_pwd.py::Test::test_compare_simple[Jess's-Jess'-s:s] XFAIL [ 34%] tests/test_pwd.py::Test::test_compare_nouns[index-index-eq] PASSED [ 35%] tests/test_pwd.py::Test::test_compare_nouns[index-indexes-s:p] PASSED [ 35%] tests/test_pwd.py::Test::test_compare_nouns[index-indices-s:p] PASSED [ 36%] tests/test_pwd.py::Test::test_compare_nouns[indexes-index-p:s] PASSED [ 36%] tests/test_pwd.py::Test::test_compare_nouns[indices-index-p:s] PASSED [ 36%] tests/test_pwd.py::Test::test_compare_nouns[indices-indexes-p:p] PASSED [ 37%] tests/test_pwd.py::Test::test_compare_nouns[indexes-indices-p:p] PASSED [ 37%] tests/test_pwd.py::Test::test_compare_nouns[indices-indices-eq] PASSED [ 38%] tests/test_pwd.py::Test::test_compare_nouns[inverted index-inverted indices-s:p] PASSED [ 38%] tests/test_pwd.py::Test::test_compare_nouns[inverted indices-inverted index-p:s] PASSED [ 39%] tests/test_pwd.py::Test::test_compare_nouns[inverted indexes-inverted indices-p:p] PASSED [ 39%] tests/test_pwd.py::Test::test_compare_verbs[runs-runs-eq] PASSED [ 40%] tests/test_pwd.py::Test::test_compare_verbs[runs-run-s:p] PASSED [ 40%] tests/test_pwd.py::Test::test_compare_verbs[run-run-eq] PASSED [ 40%] tests/test_pwd.py::Test::test_compare_adjectives[my-my-eq] PASSED [ 41%] tests/test_pwd.py::Test::test_compare_adjectives[my-our-s:p] PASSED [ 41%] tests/test_pwd.py::Test::test_compare_adjectives[our-our-eq] PASSED [ 42%] tests/test_pwd.py::Test::test_compare_adjectives[dresses's-dresses'-p:p] XFAIL [ 42%] tests/test_pwd.py::Test::test_compare_adjectives[dress's-dress'-s:s] XFAIL [ 43%] tests/test_pwd.py::Test::test_compare_adjectives[Jess's-Jess'-s:s] XFAIL [ 43%] tests/test_pwd.py::Test::test_compare_your_our XFAIL [ 44%] tests/test_pwd.py::Test::test__pl_reg_plurals PASSED [ 44%] tests/test_pwd.py::Test::test__pl_check_plurals_N PASSED [ 45%] tests/test_pwd.py::Test::test__pl_check_plurals_adj PASSED [ 45%] tests/test_pwd.py::Test::test_count PASSED [ 45%] tests/test_pwd.py::Test::test__plnoun PASSED [ 46%] tests/test_pwd.py::Test::test_plnoun_retains_case[about ME-about US] XFAIL [ 46%] tests/test_pwd.py::Test::test_plnoun_retains_case[YOU-YOU] XFAIL (does not keep case) [ 47%] tests/test_pwd.py::Test::test_classical_pl PASSED [ 47%] tests/test_pwd.py::Test::test__pl_special_verb FAILED [ 48%] tests/test_pwd.py::Test::test__pl_general_verb PASSED [ 48%] tests/test_pwd.py::Test::test__pl_special_adjective[a-some] PASSED [ 49%] tests/test_pwd.py::Test::test__pl_special_adjective[my-our] PASSED [ 49%] tests/test_pwd.py::Test::test__pl_special_adjective[John's-Johns'] PASSED [ 50%] tests/test_pwd.py::Test::test__pl_special_adjective[tuna's-tuna's] PASSED [ 50%] tests/test_pwd.py::Test::test__pl_special_adjective[TUNA's-TUNA's] PASSED [ 50%] tests/test_pwd.py::Test::test__pl_special_adjective[bad-False] PASSED [ 51%] tests/test_pwd.py::Test::test__pl_special_adjective[JOHN's-JOHNS'] XFAIL [ 51%] tests/test_pwd.py::Test::test__pl_special_adjective[JOHN'S-JOHNS'] XFAIL [ 52%] tests/test_pwd.py::Test::test__pl_special_adjective[TUNA'S-TUNA'S] XFAIL [ 52%] tests/test_pwd.py::Test::test_a[cat-a cat] PASSED [ 53%] tests/test_pwd.py::Test::test_a[euphemism-a euphemism] PASSED [ 53%] tests/test_pwd.py::Test::test_a[Euler number-an Euler number] PASSED [ 54%] tests/test_pwd.py::Test::test_a[hour-an hour] PASSED [ 54%] tests/test_pwd.py::Test::test_a[houri-a houri] PASSED [ 54%] tests/test_pwd.py::Test::test_a[nth-an nth] PASSED [ 55%] tests/test_pwd.py::Test::test_a[rth-an rth] PASSED [ 55%] tests/test_pwd.py::Test::test_a[sth-an sth] PASSED [ 56%] tests/test_pwd.py::Test::test_a[xth-an xth] PASSED [ 56%] tests/test_pwd.py::Test::test_a[ant-an ant] PASSED [ 57%] tests/test_pwd.py::Test::test_a[book-a book] PASSED [ 57%] tests/test_pwd.py::Test::test_a[RSPCA-an RSPCA] PASSED [ 58%] tests/test_pwd.py::Test::test_a[SONAR-a SONAR] PASSED [ 58%] tests/test_pwd.py::Test::test_a[FJO-a FJO] PASSED [ 59%] tests/test_pwd.py::Test::test_a[FJ-an FJ] PASSED [ 59%] tests/test_pwd.py::Test::test_a[NASA-a NASA] PASSED [ 59%] tests/test_pwd.py::Test::test_a[UN-a UN] PASSED [ 60%] tests/test_pwd.py::Test::test_a[yak-a yak] PASSED [ 60%] tests/test_pwd.py::Test::test_a[yttrium-an yttrium] PASSED [ 61%] tests/test_pwd.py::Test::test_a[a elephant-an elephant] PASSED [ 61%] tests/test_pwd.py::Test::test_a[a giraffe-a giraffe] PASSED [ 62%] tests/test_pwd.py::Test::test_a[an ewe-a ewe] PASSED [ 62%] tests/test_pwd.py::Test::test_a[a orangutan-an orangutan] PASSED [ 63%] tests/test_pwd.py::Test::test_a[R.I.P.-an R.I.P.] PASSED [ 63%] tests/test_pwd.py::Test::test_a[C.O.D.-a C.O.D.] PASSED [ 63%] tests/test_pwd.py::Test::test_a[e-mail-an e-mail] PASSED [ 64%] tests/test_pwd.py::Test::test_a[X-ray-an X-ray] PASSED [ 64%] tests/test_pwd.py::Test::test_a[T-square-a T-square] PASSED [ 65%] tests/test_pwd.py::Test::test_a[LCD-an LCD] PASSED [ 65%] tests/test_pwd.py::Test::test_a[XML-an XML] PASSED [ 66%] tests/test_pwd.py::Test::test_a[YWCA-a YWCA] PASSED [ 66%] tests/test_pwd.py::Test::test_a[LED-a LED] PASSED [ 67%] tests/test_pwd.py::Test::test_a[OPEC-an OPEC] PASSED [ 67%] tests/test_pwd.py::Test::test_a[FAQ-a FAQ] PASSED [ 68%] tests/test_pwd.py::Test::test_a[UNESCO-a UNESCO] PASSED [ 68%] tests/test_pwd.py::Test::test_a[a-an a] PASSED [ 68%] tests/test_pwd.py::Test::test_a[an-an an] PASSED [ 69%] tests/test_pwd.py::Test::test_a[an ant-an ant] PASSED [ 69%] tests/test_pwd.py::Test::test_a[a cat-a cat] PASSED [ 70%] tests/test_pwd.py::Test::test_a[an cat-a cat] PASSED [ 70%] tests/test_pwd.py::Test::test_a[a ant-an ant] PASSED [ 71%] tests/test_pwd.py::Test::test_a_alt FAILED [ 71%] tests/test_pwd.py::Test::test_a_and_an_same_method PASSED [ 72%] tests/test_pwd.py::Test::test_no PASSED [ 72%] tests/test_pwd.py::Test::test_prespart[runs-running] PASSED [ 72%] tests/test_pwd.py::Test::test_prespart[dies-dying] PASSED [ 73%] tests/test_pwd.py::Test::test_prespart[glues-gluing] PASSED [ 73%] tests/test_pwd.py::Test::test_prespart[eyes-eying] PASSED [ 74%] tests/test_pwd.py::Test::test_prespart[skis-skiing] PASSED [ 74%] tests/test_pwd.py::Test::test_prespart[names-naming] PASSED [ 75%] tests/test_pwd.py::Test::test_prespart[sees-seeing] PASSED [ 75%] tests/test_pwd.py::Test::test_prespart[hammers-hammering] PASSED [ 76%] tests/test_pwd.py::Test::test_prespart[bats-batting] PASSED [ 76%] tests/test_pwd.py::Test::test_prespart[eats-eating] PASSED [ 77%] tests/test_pwd.py::Test::test_prespart[loves-loving] PASSED [ 77%] tests/test_pwd.py::Test::test_prespart[spies-spying] PASSED [ 77%] tests/test_pwd.py::Test::test_prespart[hoes-hoeing] PASSED [ 78%] tests/test_pwd.py::Test::test_prespart[alibis-alibiing] PASSED [ 78%] tests/test_pwd.py::Test::test_prespart[is-being] PASSED [ 79%] tests/test_pwd.py::Test::test_prespart[are-being] PASSED [ 79%] tests/test_pwd.py::Test::test_prespart[had-having] PASSED [ 80%] tests/test_pwd.py::Test::test_prespart[has-having] PASSED [ 80%] tests/test_pwd.py::Test::test_ordinal[1-1st] PASSED [ 81%] tests/test_pwd.py::Test::test_ordinal[2-2nd] PASSED [ 81%] tests/test_pwd.py::Test::test_ordinal[3-3rd] PASSED [ 81%] tests/test_pwd.py::Test::test_ordinal[4-4th] PASSED [ 82%] tests/test_pwd.py::Test::test_ordinal[10-10th] PASSED [ 82%] tests/test_pwd.py::Test::test_ordinal[28-28th] PASSED [ 83%] tests/test_pwd.py::Test::test_ordinal[100-100th] PASSED [ 83%] tests/test_pwd.py::Test::test_ordinal[101-101st] PASSED [ 84%] tests/test_pwd.py::Test::test_ordinal[1000-1000th] PASSED [ 84%] tests/test_pwd.py::Test::test_ordinal[1001-1001st] PASSED [ 85%] tests/test_pwd.py::Test::test_ordinal[0-0th] PASSED [ 85%] tests/test_pwd.py::Test::test_ordinal[one-first] PASSED [ 86%] tests/test_pwd.py::Test::test_ordinal[two-second] PASSED [ 86%] tests/test_pwd.py::Test::test_ordinal[four-fourth] PASSED [ 86%] tests/test_pwd.py::Test::test_ordinal[twenty-twentieth] PASSED [ 87%] tests/test_pwd.py::Test::test_ordinal[one hundered-one hunderedth] PASSED [ 87%] tests/test_pwd.py::Test::test_ordinal[one hundered and one-one hundered and first] PASSED [ 88%] tests/test_pwd.py::Test::test_ordinal[zero-zeroth] PASSED [ 88%] tests/test_pwd.py::Test::test_ordinal[n-nth] PASSED [ 89%] tests/test_pwd.py::Test::test_millfn PASSED [ 89%] tests/test_pwd.py::Test::test_unitfn PASSED [ 90%] tests/test_pwd.py::Test::test_tenfn PASSED [ 90%] tests/test_pwd.py::Test::test_hundfn PASSED [ 90%] tests/test_pwd.py::Test::test_enword PASSED [ 91%] tests/test_pwd.py::Test::test_enword_number_args_override XFAIL (doesn't use indicated word for 'one') [ 91%] tests/test_pwd.py::Test::test_numwords PASSED [ 92%] tests/test_pwd.py::Test::test_numwords_group_chunking_error PASSED [ 92%] tests/test_pwd.py::Test::test_numwords_group[12345-kwargs0-twelve, thirty-four, five] PASSED [ 93%] tests/test_pwd.py::Test::test_numwords_group[123456-kwargs1-one twenty-three, four fifty-six] PASSED [ 93%] tests/test_pwd.py::Test::test_numwords_group[12345-kwargs2-one, two, three, four, five] PASSED [ 94%] tests/test_pwd.py::Test::test_numwords_group[1234th-kwargs3-one thousand, two hundred and thirty-fourth] PASSED [ 94%] tests/test_pwd.py::Test::test_numwords_group[1234th-kwargs4-one thousand, two hundred and thirty-fourth] PASSED [ 95%] tests/test_pwd.py::Test::test_numwords_group[120-kwargs5-twelve, zero] PASSED [ 95%] tests/test_pwd.py::Test::test_numwords_group[120-kwargs6-twelve, oh] PASSED [ 95%] tests/test_pwd.py::Test::test_numwords_group[555_1202-kwargs7-five, five, five, one, two, oh, two] PASSED [ 96%] tests/test_pwd.py::Test::test_numwords_group[555_1202-kwargs8-five, five, five, unity, two, zero, two] PASSED [ 96%] tests/test_pwd.py::Test::test_numwords_group[123.456-kwargs9-one, two, three, mark, four, five, six] PASSED [ 97%] tests/test_pwd.py::Test::test_numwords_group[12345-kwargs10-one hundred and twenty-three] XFAIL [ 97%] tests/test_pwd.py::Test::test_numwords_group[101-kwargs11-ten, unity] XFAIL [ 98%] tests/test_pwd.py::Test::test_wordlist PASSED [ 98%] tests/test_pwd.py::Test::test_doc_examples PASSED [ 99%] tests/test_pwd.py::Test::test_unknown_method PASSED [ 99%] tests/test_unicode.py::TestUnicode::test_unicode_plural PASSED [100%] =================================== FAILURES =================================== __________________________________ test_many ___________________________________ def test_many(): # noqa: C901 p = inflect.engine() data = get_data() for line in data: if "TODO:" in line: continue try: singular, rest = line.split("->", 1) except ValueError: continue singular = singular.strip() rest = rest.strip() try: plural, comment = rest.split("#", 1) except ValueError: plural = rest.strip() comment = "" try: mod_plural, class_plural = plural.split("|", 1) mod_plural = mod_plural.strip() class_plural = class_plural.strip() except ValueError: mod_plural = class_plural = plural.strip() if "verb" in comment.lower(): is_nv = "_V" elif "noun" in comment.lower(): is_nv = "_N" else: is_nv = "" p.classical(all=0, names=0) mod_PL_V = p.plural_verb(singular) mod_PL_N = p.plural_noun(singular) mod_PL = p.plural(singular) if is_nv == "_V": mod_PL_val = mod_PL_V elif is_nv == "_N": mod_PL_val = mod_PL_N else: mod_PL_val = mod_PL p.classical(all=1) class_PL_V = p.plural_verb(singular) class_PL_N = p.plural_noun(singular) class_PL = p.plural(singular) if is_nv == "_V": class_PL_val = class_PL_V elif is_nv == "_N": class_PL_val = class_PL_N else: class_PL_val = class_PL > check_all( p, is_nv, singular, mod_PL_val, class_PL_val, mod_plural, class_plural ) tests/test_inflections.py:71: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ p = , is_nv = '' singular = 'pair of scissors', mod_PL_val = 'pair of scissors' class_PL_val = 'pair of scissors', mod_plural = 'pairs of scissors' class_plural = 'pairs of scissors' def check_all(p, is_nv, singular, mod_PL_val, class_PL_val, mod_plural, class_plural): > assert mod_plural == mod_PL_val E AssertionError: assert 'pairs of scissors' == 'pair of scissors' E E - pair of scissors E + pairs of scissors E ? + tests/test_inflections.py:77: AssertionError _________________________________ Test.test_pl _________________________________ self = def test_pl(self): p = inflect.engine() for fn, sing, plur in ( (p.plural, "cow", "cows"), (p.plural, "thought", "thoughts"), (p.plural, "mouse", "mice"), (p.plural, "knife", "knives"), (p.plural, "knifes", "knife"), (p.plural, " cat ", " cats "), (p.plural, "court martial", "courts martial"), (p.plural, "a", "some"), (p.plural, "carmen", "carmina"), (p.plural, "quartz", "quartzes"), (p.plural, "care", "cares"), (p.plural_noun, "cow", "cows"), (p.plural_noun, "thought", "thoughts"), (p.plural_noun, "snooze", "snoozes"), (p.plural_verb, "runs", "run"), (p.plural_verb, "thought", "thought"), (p.plural_verb, "eyes", "eye"), (p.plural_adj, "a", "some"), (p.plural_adj, "this", "these"), (p.plural_adj, "that", "those"), (p.plural_adj, "my", "our"), (p.plural_adj, "cat's", "cats'"), (p.plural_adj, "child's", "children's"), ): assert ( fn(sing) == plur ), f'{fn.__name__}("{sing}") == "{fn(sing)}" != "{plur}"' for sing, num, plur in ( ("cow", 1, "cow"), ("cow", 2, "cows"), ("cow", "one", "cow"), ("cow", "each", "cow"), ("cow", "two", "cows"), ("cow", 0, "cows"), ("cow", "zero", "cows"), ("runs", 0, "run"), ("runs", 1, "runs"), ("am", 0, "are"), ): assert p.plural(sing, num) == plur p.classical(zero=True) assert p.plural("cow", 0) == "cow" assert p.plural("cow", "zero") == "cow" assert p.plural("runs", 0) == "runs" assert p.plural("am", 0) == "am" assert p.plural_verb("runs", 1) == "runs" assert p.plural("die") == "dice" assert p.plural_noun("die") == "dice" with pytest.raises(TypeCheckError): > p.plural("") tests/test_pwd.py:294: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.11/site-packages/pydantic/validate_call_decorator.py:58: in wrapper_function return validate_call_wrapper(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = (, ''), kwargs = {} def __call__(self, *args: Any, **kwargs: Any) -> Any: > res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs)) E pydantic_core._pydantic_core.ValidationError: 1 validation error for plural E 1 E String should have at least 1 character [type=string_too_short, input_value='', input_type=str] E For further information visit https://errors.pydantic.dev/2.6/v/string_too_short /usr/lib/python3.11/site-packages/pydantic/_internal/_validate_call.py:81: ValidationError __________________________ Test.test__pl_special_verb __________________________ self = def test__pl_special_verb(self): p = inflect.engine() with pytest.raises(TypeCheckError): > p._pl_special_verb("") tests/test_pwd.py:700: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.11/site-packages/inflect/__init__.py:2997: in _pl_special_verb value = self.ud_match(word, self.pl_v_user_defined) /usr/lib/python3.11/site-packages/pydantic/validate_call_decorator.py:58: in wrapper_function return validate_call_wrapper(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = (, '', []), kwargs = {} def __call__(self, *args: Any, **kwargs: Any) -> Any: > res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs)) E pydantic_core._pydantic_core.ValidationError: 1 validation error for ud_match E 1 E String should have at least 1 character [type=string_too_short, input_value='', input_type=str] E For further information visit https://errors.pydantic.dev/2.6/v/string_too_short /usr/lib/python3.11/site-packages/pydantic/_internal/_validate_call.py:81: ValidationError _______________________________ Test.test_a_alt ________________________________ self = def test_a_alt(self): p = inflect.engine() assert p.a("cat", 1) == "a cat" assert p.a("cat", 2) == "2 cat" with pytest.raises(TypeCheckError): > p.a("") tests/test_pwd.py:823: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.11/site-packages/pydantic/validate_call_decorator.py:58: in wrapper_function return validate_call_wrapper(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = (, ''), kwargs = {} def __call__(self, *args: Any, **kwargs: Any) -> Any: > res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs)) E pydantic_core._pydantic_core.ValidationError: 1 validation error for a E 1 E String should have at least 1 character [type=string_too_short, input_value='', input_type=str] E For further information visit https://errors.pydantic.dev/2.6/v/string_too_short /usr/lib/python3.11/site-packages/pydantic/_internal/_validate_call.py:81: ValidationError =========================== short test summary info ============================ FAILED tests/test_inflections.py::test_many - AssertionError: assert 'pairs o... FAILED tests/test_pwd.py::Test::test_pl - pydantic_core._pydantic_core.Valida... FAILED tests/test_pwd.py::Test::test__pl_special_verb - pydantic_core._pydant... FAILED tests/test_pwd.py::Test::test_a_alt - pydantic_core._pydantic_core.Val... ================== 4 failed, 202 passed, 16 xfailed in 0.88s =================== ==> ERROR:(B A failure occurred in check().(B  Aborting...(B ```
jaraco commented 4 months ago

The errors seem to be about pydantic being present, yet pydantic was removed as a dependency in 7.2.0. My suspicion - you're using inflect 7.2 tests against an older inflect version.

I don't think there's anything this project can do. Please inspect your environment and report back if you think there's a defect this project can address.

dvzrv commented 4 months ago

The errors seem to be about pydantic being present, yet pydantic was removed as a dependency in 7.2.0.

I'm aware that there has been a change and I removed the dependency when I built 7.2.0, see: https://gitlab.archlinux.org/archlinux/packaging/packages/python-inflect/-/commit/802b67343696b0d846049d48bea0cd04edaceeaf

With 7.2.0-1 I had the following packages installed:

repod-file package inspect -Bp $PWD/python-inflect-7.2.0-1-any.pkg.tar.zst | jq -r '.installed[] |select(startswith("python"))'
python-3.11.8-1-x86_64
python-annotated-types-0.6.0-1-any
python-autocommand-2.2.2-4-any
python-build-1.2.1-1-any
python-fastjsonschema-2.19.1-1-any
python-importlib_resources-6.4.0-1-any
python-inflect-7.0.0-3-any
python-iniconfig-2.0.0-4-any
python-installer-0.7.0-4-any
python-jaraco.context-4.3.0-3-any
python-jaraco.functools-4.0.0-1-any
python-jaraco.text-3.12.0-1-any
python-more-itertools-10.2.0-1-any
python-ordered-set-4.1.0-4-any
python-packaging-23.2-1-any
python-platformdirs-4.2.0-1-any
python-pluggy-1.4.0-2-any
python-pydantic-2.6.4-1-any
python-pydantic-core-1:2.16.3-1-x86_64
python-pyproject-hooks-1.0.0-5-any
python-pytest-1:8.1.1-1-any
python-pytest-enabler-3.1.1-1-any
python-setuptools-1:69.0.3-4-any
python-setuptools-scm-8.0.4-1-any
python-toml-0.10.2-9-any
python-tomli-2.0.1-3-any
python-trove-classifiers-2024.3.25-1-any
python-typeguard-4.2.0-1-any
python-typing_extensions-4.10.0-1-any
python-validate-pyproject-0.13-1-any
python-wheel-0.43.0-1-any
python-zipp-3.17.0-1-any

As you can see, python-inflect is a circular dependency on itself for build requirements via python-inflect -> python-jaraco.text -> python-setuptools and for test requirements via python-inflect -> python-jaraco.itertools -> python-zipp -> python-importlib_resources -> python-pytest-enabler.

It therefore pulls in itself in an older version.