Skip to content

Commit de290ab

Browse files
committed
style(payments): apply ruff format to plugin + tests
1 parent 4c771a2 commit de290ab

2 files changed

Lines changed: 23 additions & 15 deletions

File tree

  • src/bedrock_agentcore/payments/integrations/strands
  • tests/bedrock_agentcore/payments/integrations/strands

src/bedrock_agentcore/payments/integrations/strands/plugin.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -778,11 +778,17 @@ def http_request(
778778
logger.error("http_request failed for %s: %s", url, exc)
779779
return {
780780
"status": "error",
781-
"content": [{"text": json.dumps({
782-
"statusCode": 0,
783-
"error": f"Request failed: {exc}",
784-
"url": url,
785-
})}],
781+
"content": [
782+
{
783+
"text": json.dumps(
784+
{
785+
"statusCode": 0,
786+
"error": f"Request failed: {exc}",
787+
"url": url,
788+
}
789+
)
790+
}
791+
],
786792
}
787793

788794
response_headers = dict(resp.headers)

tests/bedrock_agentcore/payments/integrations/strands/test_tools.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,15 +1747,17 @@ def test_402_uses_payment_required_marker(self, mock_client_cls):
17471747
x402_body = {
17481748
"x402Version": 2,
17491749
"error": "Payment required",
1750-
"accepts": [{
1751-
"scheme": "exact",
1752-
"network": "eip155:84532",
1753-
"amount": "1000",
1754-
"asset": "0x036C",
1755-
"payTo": "0xabc",
1756-
"maxTimeoutSeconds": 300,
1757-
"extra": {"name": "USDC", "version": "2"},
1758-
}],
1750+
"accepts": [
1751+
{
1752+
"scheme": "exact",
1753+
"network": "eip155:84532",
1754+
"amount": "1000",
1755+
"asset": "0x036C",
1756+
"payTo": "0xabc",
1757+
"maxTimeoutSeconds": 300,
1758+
"extra": {"name": "USDC", "version": "2"},
1759+
}
1760+
],
17591761
}
17601762
mock_client.request.return_value = self._mock_response(
17611763
402, headers={"PAYMENT-REQUIRED": "base64..."}, json_body=x402_body
@@ -1766,7 +1768,7 @@ def test_402_uses_payment_required_marker(self, mock_client_cls):
17661768
assert result["status"] == "success"
17671769
text = result["content"][0]["text"]
17681770
assert text.startswith("PAYMENT_REQUIRED: ")
1769-
payload = json.loads(text[len("PAYMENT_REQUIRED: "):])
1771+
payload = json.loads(text[len("PAYMENT_REQUIRED: ") :])
17701772
assert payload["statusCode"] == 402
17711773
assert payload["body"]["x402Version"] == 2
17721774
assert payload["body"]["accepts"][0]["network"] == "eip155:84532"

0 commit comments

Comments
 (0)