[Bug]: TestSearch.test_chars_valid test failure
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start by running the reproduction commands in a clean environment and inspect tests/unit/templating/test_templating_util.py, especially TestSearch.test_chars_valid. Compare the failing parameterized case with the passing cases and verify the complete pytest suite succeeds with the expected named result.
Written by the indexing model from the issue text.
Description
Actual Behavior
Test failed
Expected Behavior
Test succeeds
Steps to Reproduce
Try to run the tests using ...
python3 -m venv --clear --system-site-packages testenv
testenv/bin/python3 -m installer dist/*.whl
testenv/bin/python3 -m pytest
OpenAPI Core Version
0.19.2
OpenAPI Core Integration
No integration
Affected Area(s)
testing
References
No response
Anything else we need to know?
Please let me know if I am doing anything drastically wrong here, but I expect this to just work. Any help is greatly appreciated. :)
The tests worked fine with 0.19.1, the code for building the package on Alpine (and running the test suite) is here: https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/testing/py3-openapi-core/APKBUILD
The test environment is a clean Alpine Linux docker container with these additional packages:
py3-isodate-pyc (0.6.1-r5)
py3-isodate (0.6.1-r5)
py3-more-itertools-pyc (10.2.0-r1)
py3-more-itertools (10.2.0-r1)
py3-openapi-spec-validator-pyc (0.7.1-r0)
py3-openapi-spec-validator (0.7.1-r0)
py3-jsonschema-path-pyc (0.3.2-r0)
py3-jsonschema-path (0.3.2-r0)
py3-pathable-pyc (0.4.3-r0)
py3-pathable (0.4.3-r0)
py3-openapi-schema-validator-pyc (0.6.2-r0)
py3-openapi-schema-validator (0.6.2-r0)
py3-jsonschema-pyc (4.22.0-r0)
py3-jsonschema (4.22.0-r0)
py3-jsonschema-specifications-pyc (2023.12.1-r1)
py3-jsonschema-specifications (2023.12.1-r1)
py3-referencing-pyc (0.35.1-r0)
py3-referencing (0.35.1-r0)
py3-rpds-py-pyc (0.18.1_git20240605-r0)
py3-rpds-py (0.18.1_git20240605-r0)
py3-rfc3339-validator-pyc (0.1.4-r0)
py3-rfc3339-validator (0.1.4-r0)
py3-six-pyc (1.16.0-r9)
py3-six (1.16.0-r9)
py3-lazy-object-proxy-pyc (1.10.0-r1)
py3-lazy-object-proxy (1.10.0-r1)
py3-parse-pyc (1.20.0-r1)
py3-parse (1.20.0-r1)
py3-gpep517-pyc (16-r0)
py3-gpep517 (16-r0)
py3-installer-pyc (0.7.0-r2)
py3-installer (0.7.0-r2)
py3-setuptools-pyc (70.0.0-r0)
py3-setuptools (70.0.0-r0)
py3-wheel-pyc (0.42.0-r1)
py3-wheel (0.42.0-r1)
py3-poetry-core-pyc (1.9.0-r0)
py3-poetry-core (1.9.0-r0)
py3-fastjsonschema-pyc (2.20.0-r0)
py3-fastjsonschema (2.20.0-r0)
py3-lark-parser-pyc (1.1.9-r1)
py3-lark-parser (1.1.9-r1)
py3-pytest-aiohttp-pyc (1.0.5-r3)
py3-pytest-aiohttp (1.0.5-r3)
py3-pytest-asyncio-pyc (0.23.6-r0)
py3-pytest-asyncio (0.23.6-r0)
py3-pytest-pyc (8.2.2-r0)
py3-pytest (8.2.2-r0)
py3-iniconfig-pyc (2.0.0-r1)
py3-iniconfig (2.0.0-r1)
py3-packaging-pyc (24.1-r0)
py3-packaging (24.1-r0)
py3-parsing-pyc (3.1.2-r1)
py3-parsing (3.1.2-r1)
py3-pluggy-pyc (1.5.0-r0)
py3-pluggy (1.5.0-r0)
py3-py-pyc (1.11.0-r3)
py3-py (1.11.0-r3)
py3-aiohttp-pyc (3.9.3-r1)
py3-aiohttp (3.9.3-r1)
py3-aiosignal-pyc (1.3.1-r3)
py3-aiosignal (1.3.1-r3)
py3-frozenlist-pyc (1.4.1-r1)
py3-frozenlist (1.4.1-r1)
py3-async-timeout-pyc (4.0.3-r1)
py3-async-timeout (4.0.3-r1)
py3-attrs-pyc (23.2.0-r1)
py3-attrs (23.2.0-r1)
py3-brotli-pyc (1.1.0-r2)
py3-brotli (1.1.0-r2)
py3-idna-ssl-pyc (1.1.0-r9)
py3-idna-ssl (1.1.0-r9)
py3-yarl-pyc (1.9.4-r1)
py3-yarl (1.9.4-r1)
py3-django-rest-framework-pyc (3.15.1-r2)
py3-django-rest-framework (3.15.1-r2)
py3-django-pyc (4.2.12-r0)
py3-django (4.2.12-r0)
py3-asgiref-pyc (3.8.1-r1)
py3-asgiref (3.8.1-r1)
py3-sqlparse-pyc (0.4.4-r2)
py3-sqlparse (0.4.4-r2)
tzdata (2024a-r1)
py3-tz-pyc (2024.1-r1)
py3-tz (2024.1-r1)
py3-fastapi-pyc (0.111.0-r0)
py3-fastapi (0.111.0-r0)
py3-pydantic-pyc (2.6.4-r1)
py3-pydantic (2.6.4-r1)
py3-annotated-types-pyc (0.7.0-r0)
py3-annotated-types (0.7.0-r0)
py3-pydantic-core-pyc (2.16.3-r1)
py3-pydantic-core (2.16.3-r1)
py3-typing-extensions-pyc (4.11.0-r1)
py3-typing-extensions (4.11.0-r1)
py3-flask-pyc (3.0.3-r0)
py3-flask (3.0.3-r0)
py3-blinker-pyc (1.7.0-r1)
py3-blinker (1.7.0-r1)
py3-click-pyc (8.1.7-r2)
py3-click (8.1.7-r2)
py3-itsdangerous-pyc (2.1.2-r4)
py3-itsdangerous (2.1.2-r4)
py3-jinja2-pyc (3.1.4-r0)
py3-jinja2 (3.1.4-r0)
py3-werkzeug-pyc (3.0.3-r0)
py3-werkzeug (3.0.3-r0)
py3-markupsafe-pyc (2.1.5-r1)
py3-markupsafe (2.1.5-r1)
py3-httpx-pyc (0.27.0-r1)
py3-httpx (0.27.0-r1)
py3-httpcore-pyc (1.0.4-r1)
py3-httpcore (1.0.4-r1)
py3-h11-pyc (0.14.0-r4)
py3-h11 (0.14.0-r4)
py3-multidict-pyc (6.0.5-r1)
py3-multidict (6.0.5-r1)
py3-responses-pyc (0.25.0-r1)
py3-responses (0.25.0-r1)
py3-toml-pyc (0.10.2-r7)
py3-toml (0.10.2-r7)
py3-yaml-pyc (6.0.1-r3)
py3-yaml (6.0.1-r3)
py3-starlette-pyc (0.37.2-r2)
py3-starlette (0.37.2-r2)
py3-anyio-pyc (4.3.0-r2)
py3-anyio (4.3.0-r2)
py3-sniffio-pyc (1.3.1-r1)
py3-sniffio (1.3.1-r1)
py3-curio-pyc (1.6-r2)
py3-curio (1.6-r2)
ccache (4.9.1-r0)
hiredis (1.2.0-r0)
yaml (0.2.5-r2)
Test output:
================================================================ FAILURES =================================================================
_________________________________________ TestSearch.test_chars_valid[/{test-id}/test-expected2] __________________________________________
self = <test_templating_util.TestSearch object at 0x7a1665bd8290>, path_pattern = '/{test-id}/test', expected = {'test-id': 'test'}
@pytest.mark.parametrize(
"path_pattern,expected",
[
("/{test_id}/test", {"test_id": "test"}),
("/{test.id}/test", {"test.id": "test"}),
("/{test-id}/test", {"test-id": "test"}),
],
)
def test_chars_valid(self, path_pattern, expected):
full_url_pattern = "/test/test"
result = search(path_pattern, full_url_pattern)
> assert result.named == expected
E AttributeError: 'NoneType' object has no attribute 'named'
expected = {'test-id': 'test'}
full_url_pattern = '/test/test'
path_pattern = '/{test-id}/test'
result = None
self = <test_templating_util.TestSearch object at 0x7a1665bd8290>
tests/unit/templating/test_templating_util.py:40: AttributeError
-------------- generated xml file: /home/buildozer/aports/testing/py3-openapi-core/src/openapi-core-0.19.2/reports/junit.xml --------------
========================================================= short test summary info =========================================================
FAILED tests/unit/templating/test_templating_util.py::TestSearch::test_chars_valid[/{test-id}/test-expected2] - AttributeError: 'NoneType'
Test is run like this:
python3 -m venv --clear --system-site-packages testenv
testenv/bin/python3 -m installer dist/*.whl
testenv/bin/python3 -m pytest
Would you like to implement a fix?
No
- Dominant language
- Python
- Stars
- 368
- Forks
- 140
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python-openapi/openapi-core
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
python-openapi/openapi-core#1188 · 2 comments ·
-
kind/bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
python-openapi/openapi-core#1225 · 2 comments ·
-
kind/bug
Difficulty 3/5 1-2 days Newbie friendliness 76/100
python-openapi/openapi-core#1212 ·
-
[Bug]: Query parameter validation fails to match empty string when listed as a valid enum value Openkind/bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
python-openapi/openapi-core#1210 ·
-
kind/bug kind/bug/confirmed
Difficulty 3/5 1-2 days Newbie friendliness 58/100
python-openapi/openapi-core#1180 · 3 comments ·
All issues in python-openapi/openapi-core
Similar issues
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DiamondLightSource/dodal#2211 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
openml/openml-python#1749 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sipyourdrink-ltd/bernstein#6191 ·