Skip to content

Commit fe9472d

Browse files
committed
chore: add tests
1 parent 2c783e8 commit fe9472d

2 files changed

Lines changed: 31 additions & 6 deletions

File tree

docs/source/index.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Python SDK for [Replane](https://replane.dev) - a dynamic configuration platform
1313

1414
## Quick Example
1515

16+
### Sync Client
17+
1618
```python
1719
from replane import Replane
1820

@@ -40,6 +42,33 @@ rate_limit = replane.configs["rate-limit"]
4042
replane.close()
4143
```
4244

45+
### Async Client
46+
47+
```python
48+
from replane import AsyncReplane
49+
50+
# Using async context manager (recommended)
51+
async with AsyncReplane(
52+
base_url="https://replane.example.com",
53+
sdk_key="rp_...",
54+
) as replane:
55+
rate_limit = replane.configs["rate-limit"]
56+
57+
user_client = replane.with_context({"user_id": user.id})
58+
feature_enabled = user_client.configs["new-feature"]
59+
```
60+
61+
Or without context manager:
62+
63+
```python
64+
replane = AsyncReplane()
65+
await replane.connect(base_url="...", sdk_key="...")
66+
67+
rate_limit = replane.configs["rate-limit"]
68+
69+
await replane.close()
70+
```
71+
4372
```{toctree}
4473
:maxdepth: 2
4574
:hidden:

tests/test_async_client.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ async def test_credentials_in_connect(self, mock_server: MockSSEServer):
148148
finally:
149149
await client.close()
150150

151-
async def test_connect_credentials_override_constructor(
152-
self, mock_server: MockSSEServer
153-
):
151+
async def test_connect_credentials_override_constructor(self, mock_server: MockSSEServer):
154152
"""Credentials in connect() override those in constructor."""
155153
mock_server.send_init([create_config("feature", True)])
156154

@@ -168,9 +166,7 @@ async def test_connect_credentials_override_constructor(
168166
finally:
169167
await client.close()
170168

171-
async def test_partial_credentials_in_constructor_and_connect(
172-
self, mock_server: MockSSEServer
173-
):
169+
async def test_partial_credentials_in_constructor_and_connect(self, mock_server: MockSSEServer):
174170
"""base_url in constructor, sdk_key in connect() works."""
175171
mock_server.send_init([create_config("feature", True)])
176172

0 commit comments

Comments
 (0)