Skip to content

Commit 9a3452b

Browse files
kevinjqliuCopilot
andcommitted
Use a loop for User-Agent test cases
Co-authored-by: Copilot App <[email protected]>
1 parent fb9a6ba commit 9a3452b

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

‎tests/catalog/test_rest.py‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3266,18 +3266,16 @@ def test_auth_header(rest_mock: Mocker) -> None:
32663266
)
32673267

32683268

3269-
@pytest.mark.parametrize(
3270-
("implementation", "python_version", "expected"),
3271-
[("CPython", "3.11.4", "pyiceberg/0.11.0 (cpython 3.11.4)"), ("PyPy", "3.10.16", "pyiceberg/0.11.0 (pypy 3.10.16)")],
3272-
)
3273-
def test_user_agent_header(
3274-
rest_mock: Mocker, monkeypatch: pytest.MonkeyPatch, implementation: str, python_version: str, expected: str
3275-
) -> None:
3269+
def test_user_agent_header(rest_mock: Mocker, monkeypatch: pytest.MonkeyPatch) -> None:
32763270
monkeypatch.setattr("pyiceberg.catalog.rest.__version__", "0.11.0")
3277-
monkeypatch.setattr(platform, "python_implementation", lambda: implementation)
3278-
monkeypatch.setattr(platform, "python_version", lambda: python_version)
3279-
catalog = RestCatalog("rest", uri=TEST_URI, warehouse="s3://some-bucket")
3280-
assert catalog._session.headers["User-Agent"] == expected
3271+
for implementation, python_version, expected in [
3272+
("CPython", "3.11.4", "pyiceberg/0.11.0 (cpython 3.11.4)"),
3273+
("PyPy", "3.10.16", "pyiceberg/0.11.0 (pypy 3.10.16)"),
3274+
]:
3275+
monkeypatch.setattr(platform, "python_implementation", lambda implementation=implementation: implementation)
3276+
monkeypatch.setattr(platform, "python_version", lambda python_version=python_version: python_version)
3277+
catalog = RestCatalog("rest", uri=TEST_URI, warehouse="s3://some-bucket")
3278+
assert catalog._session.headers["User-Agent"] == expected
32813279

32823280

32833281
def test_client_version_header(rest_mock: Mocker) -> None:

0 commit comments

Comments
 (0)