Skip to content

Commit

Permalink
docs(examples): use named params more (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Jul 11, 2024
1 parent 10206cf commit f42beef
Show file tree
Hide file tree
Showing 22 changed files with 636 additions and 636 deletions.
8 changes: 4 additions & 4 deletions tests/api_resources/cards/test_aggregate_balances.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def test_method_list(self, client: Lithic) -> None:
@parametrize
def test_method_list_with_all_params(self, client: Lithic) -> None:
aggregate_balance = client.cards.aggregate_balances.list(
account_token="string",
business_account_token="string",
account_token="account_token",
business_account_token="business_account_token",
)
assert_matches_type(SyncSinglePage[AggregateBalanceListResponse], aggregate_balance, path=["response"])

Expand Down Expand Up @@ -63,8 +63,8 @@ async def test_method_list(self, async_client: AsyncLithic) -> None:
@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncLithic) -> None:
aggregate_balance = await async_client.cards.aggregate_balances.list(
account_token="string",
business_account_token="string",
account_token="account_token",
business_account_token="business_account_token",
)
assert_matches_type(AsyncSinglePage[AggregateBalanceListResponse], aggregate_balance, path=["response"])

Expand Down
20 changes: 10 additions & 10 deletions tests/api_resources/cards/test_balances.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ class TestBalances:
@parametrize
def test_method_list(self, client: Lithic) -> None:
balance = client.cards.balances.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
assert_matches_type(SyncSinglePage[BalanceListResponse], balance, path=["response"])

@parametrize
def test_method_list_with_all_params(self, client: Lithic) -> None:
balance = client.cards.balances.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
balance_date=parse_datetime("2019-12-27T18:11:19.117Z"),
last_transaction_event_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
Expand All @@ -38,7 +38,7 @@ def test_method_list_with_all_params(self, client: Lithic) -> None:
@parametrize
def test_raw_response_list(self, client: Lithic) -> None:
response = client.cards.balances.with_raw_response.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)

assert response.is_closed is True
Expand All @@ -49,7 +49,7 @@ def test_raw_response_list(self, client: Lithic) -> None:
@parametrize
def test_streaming_response_list(self, client: Lithic) -> None:
with client.cards.balances.with_streaming_response.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -63,7 +63,7 @@ def test_streaming_response_list(self, client: Lithic) -> None:
def test_path_params_list(self, client: Lithic) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_token` but received ''"):
client.cards.balances.with_raw_response.list(
"",
card_token="",
)


Expand All @@ -73,14 +73,14 @@ class TestAsyncBalances:
@parametrize
async def test_method_list(self, async_client: AsyncLithic) -> None:
balance = await async_client.cards.balances.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
assert_matches_type(AsyncSinglePage[BalanceListResponse], balance, path=["response"])

@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncLithic) -> None:
balance = await async_client.cards.balances.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
balance_date=parse_datetime("2019-12-27T18:11:19.117Z"),
last_transaction_event_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
Expand All @@ -89,7 +89,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncLithic) -> N
@parametrize
async def test_raw_response_list(self, async_client: AsyncLithic) -> None:
response = await async_client.cards.balances.with_raw_response.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)

assert response.is_closed is True
Expand All @@ -100,7 +100,7 @@ async def test_raw_response_list(self, async_client: AsyncLithic) -> None:
@parametrize
async def test_streaming_response_list(self, async_client: AsyncLithic) -> None:
async with async_client.cards.balances.with_streaming_response.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -114,5 +114,5 @@ async def test_streaming_response_list(self, async_client: AsyncLithic) -> None:
async def test_path_params_list(self, async_client: AsyncLithic) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_token` but received ''"):
await async_client.cards.balances.with_raw_response.list(
"",
card_token="",
)
48 changes: 24 additions & 24 deletions tests/api_resources/cards/test_financial_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ class TestFinancialTransactions:
@parametrize
def test_method_retrieve(self, client: Lithic) -> None:
financial_transaction = client.cards.financial_transactions.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
financial_transaction_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
assert_matches_type(FinancialTransaction, financial_transaction, path=["response"])

@parametrize
def test_raw_response_retrieve(self, client: Lithic) -> None:
response = client.cards.financial_transactions.with_raw_response.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
financial_transaction_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)

Expand All @@ -42,7 +42,7 @@ def test_raw_response_retrieve(self, client: Lithic) -> None:
@parametrize
def test_streaming_response_retrieve(self, client: Lithic) -> None:
with client.cards.financial_transactions.with_streaming_response.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
financial_transaction_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
) as response:
assert not response.is_closed
Expand All @@ -57,43 +57,43 @@ def test_streaming_response_retrieve(self, client: Lithic) -> None:
def test_path_params_retrieve(self, client: Lithic) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_token` but received ''"):
client.cards.financial_transactions.with_raw_response.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
financial_transaction_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="",
)

with pytest.raises(
ValueError, match=r"Expected a non-empty value for `financial_transaction_token` but received ''"
):
client.cards.financial_transactions.with_raw_response.retrieve(
"",
financial_transaction_token="",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)

@parametrize
def test_method_list(self, client: Lithic) -> None:
financial_transaction = client.cards.financial_transactions.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
assert_matches_type(SyncSinglePage[FinancialTransaction], financial_transaction, path=["response"])

@parametrize
def test_method_list_with_all_params(self, client: Lithic) -> None:
financial_transaction = client.cards.financial_transactions.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
begin=parse_datetime("2019-12-27T18:11:19.117Z"),
category="CARD",
end=parse_datetime("2019-12-27T18:11:19.117Z"),
ending_before="string",
ending_before="ending_before",
result="APPROVED",
starting_after="string",
starting_after="starting_after",
status="DECLINED",
)
assert_matches_type(SyncSinglePage[FinancialTransaction], financial_transaction, path=["response"])

@parametrize
def test_raw_response_list(self, client: Lithic) -> None:
response = client.cards.financial_transactions.with_raw_response.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)

assert response.is_closed is True
Expand All @@ -104,7 +104,7 @@ def test_raw_response_list(self, client: Lithic) -> None:
@parametrize
def test_streaming_response_list(self, client: Lithic) -> None:
with client.cards.financial_transactions.with_streaming_response.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -118,7 +118,7 @@ def test_streaming_response_list(self, client: Lithic) -> None:
def test_path_params_list(self, client: Lithic) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_token` but received ''"):
client.cards.financial_transactions.with_raw_response.list(
"",
card_token="",
)


Expand All @@ -128,15 +128,15 @@ class TestAsyncFinancialTransactions:
@parametrize
async def test_method_retrieve(self, async_client: AsyncLithic) -> None:
financial_transaction = await async_client.cards.financial_transactions.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
financial_transaction_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
assert_matches_type(FinancialTransaction, financial_transaction, path=["response"])

@parametrize
async def test_raw_response_retrieve(self, async_client: AsyncLithic) -> None:
response = await async_client.cards.financial_transactions.with_raw_response.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
financial_transaction_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)

Expand All @@ -148,7 +148,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncLithic) -> None:
@parametrize
async def test_streaming_response_retrieve(self, async_client: AsyncLithic) -> None:
async with async_client.cards.financial_transactions.with_streaming_response.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
financial_transaction_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
) as response:
assert not response.is_closed
Expand All @@ -163,43 +163,43 @@ async def test_streaming_response_retrieve(self, async_client: AsyncLithic) -> N
async def test_path_params_retrieve(self, async_client: AsyncLithic) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_token` but received ''"):
await async_client.cards.financial_transactions.with_raw_response.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
financial_transaction_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="",
)

with pytest.raises(
ValueError, match=r"Expected a non-empty value for `financial_transaction_token` but received ''"
):
await async_client.cards.financial_transactions.with_raw_response.retrieve(
"",
financial_transaction_token="",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)

@parametrize
async def test_method_list(self, async_client: AsyncLithic) -> None:
financial_transaction = await async_client.cards.financial_transactions.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
assert_matches_type(AsyncSinglePage[FinancialTransaction], financial_transaction, path=["response"])

@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncLithic) -> None:
financial_transaction = await async_client.cards.financial_transactions.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
begin=parse_datetime("2019-12-27T18:11:19.117Z"),
category="CARD",
end=parse_datetime("2019-12-27T18:11:19.117Z"),
ending_before="string",
ending_before="ending_before",
result="APPROVED",
starting_after="string",
starting_after="starting_after",
status="DECLINED",
)
assert_matches_type(AsyncSinglePage[FinancialTransaction], financial_transaction, path=["response"])

@parametrize
async def test_raw_response_list(self, async_client: AsyncLithic) -> None:
response = await async_client.cards.financial_transactions.with_raw_response.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)

assert response.is_closed is True
Expand All @@ -210,7 +210,7 @@ async def test_raw_response_list(self, async_client: AsyncLithic) -> None:
@parametrize
async def test_streaming_response_list(self, async_client: AsyncLithic) -> None:
async with async_client.cards.financial_transactions.with_streaming_response.list(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
card_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -224,5 +224,5 @@ async def test_streaming_response_list(self, async_client: AsyncLithic) -> None:
async def test_path_params_list(self, async_client: AsyncLithic) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_token` but received ''"):
await async_client.cards.financial_transactions.with_raw_response.list(
"",
card_token="",
)
Loading

0 comments on commit f42beef

Please sign in to comment.