Add `pragma: no cover` to make coverage pass

This commit is contained in:
Yurii Motov 2026-02-05 15:38:23 +01:00
parent d90bcc8569
commit 7fed2671c4
6 changed files with 35 additions and 23 deletions

View File

@ -332,8 +332,9 @@ def test_nullable_required_no_embed_pass_null(path: str):
response = client.post(path, content="null")
assert mock_convert.call_count == 1, "Validator should be called once for the field"
assert response.status_code == 200, response.text
assert response.json() == {"val": None}
assert response.status_code == 200, response.text # pragma: no cover
assert response.json() == {"val": None} # pragma: no cover
# TODO: Remove 'no cover' when the issue is fixed
@pytest.mark.parametrize(
@ -672,8 +673,9 @@ def test_nullable_non_required_no_embed_pass_null(path: str):
response = client.post(path, content="null")
assert mock_convert.call_count == 1, "Validator should be called once for the field"
assert response.status_code == 200, response.text
assert response.json() == {"val": None}
assert response.status_code == 200, response.text # pragma: no cover
assert response.json() == {"val": None} # pragma: no cover
# TODO: Remove 'no cover' when the issue is fixed
@pytest.mark.parametrize(
@ -1019,8 +1021,9 @@ def test_nullable_with_non_null_default_no_embed_pass_null(path: str):
response = client.post(path, content="null")
assert mock_convert.call_count == 1, "Validator should be called once for the field"
assert response.status_code == 200, response.text
assert response.json() == {"val": None}
assert response.status_code == 200, response.text # pragma: no cover
assert response.json() == {"val": None} # pragma: no cover
# TODO: Remove 'no cover' when the issue is fixed
@pytest.mark.parametrize(

View File

@ -369,12 +369,13 @@ def test_nullable_with_non_null_default_missing(path: str):
assert mock_convert.call_count == 0, (
"Validator should not be called if the value is missing"
)
assert response.status_code == 200
assert response.json() == {
assert response.status_code == 200 # pragma: no cover
assert response.json() == { # pragma: no cover
"int_val": -1,
"str_val": "default",
"fields_set": IsOneOf(None, []),
}
# TODO: Remove 'no cover' when the issue is fixed
@pytest.mark.parametrize(

View File

@ -417,11 +417,12 @@ def test_nullable_with_non_null_default_missing(path: str):
with patch(f"{__name__}.convert", Mock(wraps=convert)) as mock_convert:
response = client.post(path)
assert mock_convert.call_count == 0, (
assert mock_convert.call_count == 0, ( # pragma: no cover
"Validator should not be called if the value is missing"
)
assert response.status_code == 200
assert response.json() == {"file": None, "files": None}
assert response.status_code == 200 # pragma: no cover
assert response.json() == {"file": None, "files": None} # pragma: no cover
# TODO: Remove 'no cover' when the issue is fixed
@pytest.mark.parametrize(

View File

@ -180,8 +180,8 @@ def test_nullable_required_pass_empty_str(path: str):
(""), # str_val
(["0"]), # list_val
]
assert response.status_code == 200, response.text
assert response.json() == {
assert response.status_code == 200, response.text # pragma: no cover
assert response.json() == { # pragma: no cover
"int_val": None,
"str_val": None,
"list_val": [0],
@ -189,6 +189,7 @@ def test_nullable_required_pass_empty_str(path: str):
None, IsList("int_val", "str_val", "list_val", check_order=False)
),
}
# TODO: Remove 'no cover' when the issue is fixed
@pytest.mark.parametrize(
@ -368,8 +369,8 @@ def test_nullable_non_required_pass_empty_str(path: str):
(""), # str_val
(["0"]), # list_val
]
assert response.status_code == 200, response.text
assert response.json() == {
assert response.status_code == 200, response.text # pragma: no cover
assert response.json() == { # pragma: no cover
"int_val": None,
"str_val": None,
"list_val": [0],
@ -377,6 +378,7 @@ def test_nullable_non_required_pass_empty_str(path: str):
None, IsList("int_val", "str_val", "list_val", check_order=False)
),
}
# TODO: Remove 'no cover' when the issue is fixed
@pytest.mark.parametrize(
@ -522,13 +524,14 @@ def test_nullable_with_non_null_default_missing(path: str):
assert mock_convert.call_count == 0, (
"Validator should not be called if the value is missing"
)
assert response.status_code == 200
assert response.json() == {
assert response.status_code == 200 # pragma: no cover
assert response.json() == { # pragma: no cover
"int_val": -1,
"str_val": "default",
"list_val": [0],
"fields_set": IsOneOf(None, []),
}
# TODO: Remove 'no cover' when the issue is fixed
@pytest.mark.parametrize(
@ -567,8 +570,8 @@ def test_nullable_with_non_null_default_pass_empty_str(path: str):
(""), # str_val
(["0"]), # list_val
]
assert response.status_code == 200, response.text
assert response.json() == {
assert response.status_code == 200, response.text # pragma: no cover
assert response.json() == { # pragma: no cover
"int_val": None,
"str_val": None,
"list_val": [0],
@ -576,6 +579,7 @@ def test_nullable_with_non_null_default_pass_empty_str(path: str):
None, IsList("int_val", "str_val", "list_val", check_order=False)
),
}
# TODO: Remove 'no cover' when the issue is fixed
@pytest.mark.parametrize(

View File

@ -483,13 +483,14 @@ def test_nullable_with_non_null_default_missing(path: str):
assert mock_convert.call_count == 0, (
"Validator should not be called if the value is missing"
)
assert response.status_code == 200
assert response.json() == {
assert response.status_code == 200 # pragma: no cover
assert response.json() == { # pragma: no cover
"int_val": -1,
"str_val": "default",
"list_val": [0],
"fields_set": IsOneOf(None, []),
}
# TODO: Remove 'no cover' when the issue is fixed
@pytest.mark.parametrize(

View File

@ -426,6 +426,7 @@ def test_nullable_with_non_null_default_schema(path: str):
# default_factory is not reflected in OpenAPI schema
assert parameters[2]["schema"]["default"] == [0]
@pytest.mark.parametrize(
"path",
[
@ -445,13 +446,14 @@ def test_nullable_with_non_null_default_missing(path: str):
assert mock_convert.call_count == 0, (
"Validator should not be called if the value is missing"
)
assert response.status_code == 200
assert response.json() == {
assert response.status_code == 200 # pragma: no cover
assert response.json() == { # pragma: no cover
"int_val": -1,
"str_val": "default",
"list_val": [0],
"fields_set": IsOneOf(None, []),
}
# TODO: Remove 'no cover' when the issue is fixed
@pytest.mark.parametrize(