|
|
@ -3,7 +3,6 @@ import warnings |
|
|
import pytest |
|
|
import pytest |
|
|
from fastapi import FastAPI, File, Form, UploadFile |
|
|
from fastapi import FastAPI, File, Form, UploadFile |
|
|
from fastapi.dependencies.utils import ( |
|
|
from fastapi.dependencies.utils import ( |
|
|
_version_str_to_tuple, |
|
|
|
|
|
multipart_incorrect_install_error, |
|
|
multipart_incorrect_install_error, |
|
|
multipart_not_installed_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") |
|
|
monkeypatch.setattr("python_multipart.__version__", "0.0.100") |
|
|
with warnings.catch_warnings(record=True): |
|
|
with warnings.catch_warnings(record=True): |
|
|
warnings.simplefilter("always") |
|
|
warnings.simplefilter("always") |
|
|
|
|
|
monkeypatch.delattr("multipart.__version__", raising=False) |
|
|
app = FastAPI() |
|
|
app = FastAPI() |
|
|
|
|
|
|
|
|
@app.post("/") |
|
|
@app.post("/") |
|
|
async def root(username: str = Form()): |
|
|
async def root(username: str = Form()): |
|
|
return username # pragma: nocover |
|
|
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("") == () |
|
|
|
|
|
|