Skip to content

Commit d2c98ed

Browse files
committed
Add more keyword arguments
1 parent 174be27 commit d2c98ed

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

src/mock_vws/_services_validators/content_length_validators.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ def validate_content_length_header_is_int(
3333
integer
3434
"""
3535
body_length = len(request_body)
36-
given_content_length = request_headers.get("Content-Length", body_length)
36+
given_content_length = request_headers.get(
37+
"Content-Length",
38+
default=body_length,
39+
)
3740

3841
try:
3942
int(given_content_length)
@@ -59,7 +62,10 @@ def validate_content_length_header_not_too_large(
5962
that the content length is greater than the body length.
6063
"""
6164
body_length = len(request_body)
62-
given_content_length = request_headers.get("Content-Length", body_length)
65+
given_content_length = request_headers.get(
66+
"Content-Length",
67+
default=body_length,
68+
)
6369
given_content_length_value = int(given_content_length)
6470
# We skip coverage here as running a test to cover this is very slow.
6571
if given_content_length_value > body_length: # pragma: no cover

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def endpoint(request: pytest.FixtureRequest) -> Endpoint:
108108
"""
109109
Return details of an endpoint for the Target API or the Query API.
110110
"""
111-
endpoint_fixture: Endpoint = request.getfixturevalue(request.param)
111+
endpoint_fixture: Endpoint = request.getfixturevalue(argname=request.param)
112112
return endpoint_fixture
113113

114114

tests/mock_vws/test_query.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ def test_match_similar(
665665
similar_image_data = copy.copy(x=high_quality_image)
666666
pil_similar_image = Image.open(fp=similar_image_data)
667667
# Re-save means similar but not identical.
668-
pil_similar_image.save(similar_image_buffer, format="JPEG")
668+
pil_similar_image.save(fp=similar_image_buffer, format="JPEG")
669669

670670
(matching_target,) = cloud_reco_client.query(
671671
image=similar_image_buffer,
@@ -1910,7 +1910,7 @@ def test_deleted_active(
19101910
#
19111911
# We retry to allow for this difference.
19121912
for attempt in Retrying(
1913-
wait=wait_fixed(0.1),
1913+
wait=wait_fixed(wait=0.1),
19141914
stop=stop_after_delay(max_delay=3),
19151915
retry=retry_if_exception_type(
19161916
exception_types=(AssertionError,),
@@ -2018,7 +2018,7 @@ def test_date_formats(
20182018

20192019
gmt = ZoneInfo(key="GMT")
20202020
now = datetime.datetime.now(tz=gmt)
2021-
date = now.strftime(datetime_format)
2021+
date = now.strftime(format=datetime_format)
20222022
request_path = "/v1/query"
20232023
content, content_type_header = encode_multipart_formdata(fields=body)
20242024
method = HTTPMethod.POST

tests/mock_vws/test_requests_mock_usage.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,12 @@ def test_date_changes() -> None:
376376
The date that the response is sent is in the response Date header.
377377
"""
378378
new_year = 2012
379-
new_time = datetime.datetime(new_year, 1, 1, tzinfo=datetime.UTC)
379+
new_time = datetime.datetime(
380+
year=new_year,
381+
month=1,
382+
day=1,
383+
tzinfo=datetime.UTC,
384+
)
380385
with MockVWS(), freeze_time(time_to_freeze=new_time):
381386
response = requests.get(
382387
url="https://vws.vuforia.com/summary",
@@ -445,7 +450,7 @@ def test_duplicate_keys() -> None:
445450
(bad_database_name_db, database_name_conflict_error),
446451
):
447452
with pytest.raises(
448-
ValueError,
453+
expected_exception=ValueError,
449454
match=expected_message + "$",
450455
):
451456
mock.add_database(database=bad_database)

tests/mock_vws/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def auth_header_content_type(self) -> str:
8282
"""
8383
The content type to use for the `Authorization` header.
8484
"""
85-
full_content_type = self.headers.get("Content-Type", "")
85+
full_content_type = self.headers.get("Content-Type", default="")
8686
return full_content_type.split(sep=";")[0]
8787

8888

0 commit comments

Comments
 (0)