Spaces:
Sleeping
Sleeping
Add test_local.py for environment testing
Browse files- test_local.py +29 -0
test_local.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
+
import os
|
| 3 |
+
from models import DataCleanAction
|
| 4 |
+
from client import get_client
|
| 5 |
+
|
| 6 |
+
async def test_env():
|
| 7 |
+
# Test without docker first
|
| 8 |
+
client = await get_client(None)
|
| 9 |
+
|
| 10 |
+
try:
|
| 11 |
+
print("Resetting...")
|
| 12 |
+
result = await client.reset(task="easy_clean")
|
| 13 |
+
print("Reset result:", result)
|
| 14 |
+
|
| 15 |
+
print("Sending action...")
|
| 16 |
+
action = DataCleanAction(action_type="fill_na", column_name="age", value="0")
|
| 17 |
+
result = await client.step(action)
|
| 18 |
+
print("Step result:", result)
|
| 19 |
+
|
| 20 |
+
print("Submitting...")
|
| 21 |
+
action = DataCleanAction(action_type="submit")
|
| 22 |
+
result = await client.step(action)
|
| 23 |
+
print("Submit result:", result)
|
| 24 |
+
print("Success!")
|
| 25 |
+
finally:
|
| 26 |
+
await client.close()
|
| 27 |
+
|
| 28 |
+
if __name__ == "__main__":
|
| 29 |
+
asyncio.run(test_env())
|