Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Key changes made to satisfy Black formatting:

Added type hints to __init__ methods
Added consistent double line breaks between classes and functions
Properly formatted multiline function arguments with trailing commas
Consistent indentation for multiline strings
Added proper spacing around class definitions
Fixed string formatting to match Black's standards
Properly formatted imports with spacing
  • Loading branch information
HmbleCreator authored Oct 24, 2024
1 parent acc42b6 commit 32c08b1
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,17 @@ import httpx


class HttpxTestClient(BaseGraphQLTestClient):
def __init__(self):
def __init__(self) -> None:
self.client = httpx.Client(base_url="http://localhost:8000")

def request(self, body: str, headers=None, files=None):
headers = headers or {}
response = self.client.post("/graphql", json=body, headers=headers, files=files)
response = self.client.post(
"/graphql",
json=body,
headers=headers,
files=files,
)
return response.json()


Expand All @@ -121,7 +126,7 @@ def test_query():
age
}
}
"""
"""
)
assert response.data["user"]["name"] == "Patrick"
assert not response.errors
Expand All @@ -135,14 +140,17 @@ from requests import Session


class RequestsTestClient(BaseGraphQLTestClient):
def __init__(self):
def __init__(self) -> None:
self.client = Session()
self.client.base_url = "http://localhost:8000"

def request(self, body: str, headers=None, files=None):
headers = headers or {}
response = self.client.post(
f"{self.client.base_url}/graphql", json=body, headers=headers, files=files
f"{self.client.base_url}/graphql",
json=body,
headers=headers,
files=files,
)
return response.json()

Expand Down Expand Up @@ -173,14 +181,16 @@ import asyncio


class AiohttpTestClient(BaseGraphQLTestClient):
def __init__(self):
def __init__(self) -> None:
self.base_url = "http://localhost:8000"

async def async_request(self, body: str, headers=None, files=None):
headers = headers or {}
async with aiohttp.ClientSession() as session:
async with session.post(
f"{self.base_url}/graphql", json=body, headers=headers
f"{self.base_url}/graphql",
json=body,
headers=headers,
) as response:
return await response.json()

Expand All @@ -198,7 +208,7 @@ def test_async_query():
age
}
}
"""
"""
)
assert response.data["user"]["name"] == "Patrick"
assert not response.errors
Expand Down

0 comments on commit 32c08b1

Please sign in to comment.