diff --git a/tests/test_dependencies_utils.py b/tests/test_dependencies_utils.py index 9257d1c9ee..92d735bb62 100644 --- a/tests/test_dependencies_utils.py +++ b/tests/test_dependencies_utils.py @@ -1,4 +1,11 @@ -from fastapi.dependencies.utils import get_typed_annotation +from fastapi.dependencies.utils import _version_str_to_tuple, get_typed_annotation + + +def test_version_str_to_tuple(): + assert _version_str_to_tuple("0.0.12") == (0, 0, 12) + assert _version_str_to_tuple("0.0.100") == (0, 0, 100) + assert _version_str_to_tuple("1.2.3a1") == (1, 2, 3) + assert _version_str_to_tuple("") == () def test_get_typed_annotation(): diff --git a/tests/test_multipart_installation.py b/tests/test_multipart_installation.py index 585e673112..4bf1a67a93 100644 --- a/tests/test_multipart_installation.py +++ b/tests/test_multipart_installation.py @@ -3,7 +3,6 @@ import warnings import pytest from fastapi import FastAPI, File, Form, UploadFile from fastapi.dependencies.utils import ( - _version_str_to_tuple, multipart_incorrect_install_error, multipart_not_installed_error, ) @@ -154,15 +153,9 @@ def test_new_multipart_version_without_multipart_alias(monkeypatch): monkeypatch.setattr("python_multipart.__version__", "0.0.100") with warnings.catch_warnings(record=True): warnings.simplefilter("always") + monkeypatch.delattr("multipart.__version__", raising=False) app = FastAPI() @app.post("/") async def root(username: str = Form()): return username # pragma: nocover - - -def test_version_str_to_tuple(): - assert _version_str_to_tuple("0.0.12") == (0, 0, 12) - assert _version_str_to_tuple("0.0.100") == (0, 0, 100) - assert _version_str_to_tuple("1.2.3a1") == (1, 2, 3) - assert _version_str_to_tuple("") == ()