kevinjqliu commented on code in PR #3010:
URL: https://github.com/apache/iceberg-python/pull/3010#discussion_r2819064100
##########
tests/catalog/test_rest.py:
##########
@@ -2351,3 +2353,28 @@ def test_table_uuid_check_on_refresh(rest_mock: Mocker,
example_table_metadata_v
assert "Table UUID does not match" in str(exc_info.value)
assert f"current={original_uuid}" in str(exc_info.value)
assert f"refreshed={different_uuid}" in str(exc_info.value)
+
+
[email protected](
+ "raw_string, http_method, path",
+ [
+ ("GET /v1/resource", HttpMethod.GET, "/v1/resource"),
+ ("HEAD /v1/resource", HttpMethod.HEAD, "/v1/resource"),
+ ("POST /v1/resource", HttpMethod.POST, "/v1/resource"),
+ ("DELETE /v1/resource", HttpMethod.DELETE, "/v1/resource"),
+ ("PUT /v1/resource", HttpMethod.PUT, "/v1/resource"),
+ ("CONNECT /v1/resource", HttpMethod.CONNECT, "/v1/resource"),
+ ("OPTIONS /v1/resource", HttpMethod.OPTIONS, "/v1/resource"),
+ ("TRACE /v1/resource", HttpMethod.TRACE, "/v1/resource"),
+ ("PATCH /v1/resource", HttpMethod.PATCH, "/v1/resource"),
+ ],
+)
+def test_endpoint_parsing_from_string_with_valid_http_method(raw_string: str,
http_method: HttpMethod, path: str) -> None:
+ endpoint = Endpoint.from_string(raw_string)
+ assert endpoint.http_method == http_method
+ assert endpoint.path == path
Review Comment:
```suggestion
def test_endpoint_parsing_from_string_with_valid_http_method() -> None:
test_cases = [
("GET /v1/resource", HttpMethod.GET, "/v1/resource"),
("HEAD /v1/resource", HttpMethod.HEAD, "/v1/resource"),
("POST /v1/resource", HttpMethod.POST, "/v1/resource"),
("DELETE /v1/resource", HttpMethod.DELETE, "/v1/resource"),
("PUT /v1/resource", HttpMethod.PUT, "/v1/resource"),
("CONNECT /v1/resource", HttpMethod.CONNECT, "/v1/resource"),
("OPTIONS /v1/resource", HttpMethod.OPTIONS, "/v1/resource"),
("TRACE /v1/resource", HttpMethod.TRACE, "/v1/resource"),
("PATCH /v1/resource", HttpMethod.PATCH, "/v1/resource"),
]
for raw_string, http_method, path in test_cases:
endpoint = Endpoint.from_string(raw_string)
assert endpoint.http_method == http_method
assert endpoint.path == path
```
slight nit to iterate inside the function and create fewer pytests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]