Skip to content

Commit

Permalink
⚡ Converted functions to async
Browse files Browse the repository at this point in the history
  • Loading branch information
shroominic committed Nov 8, 2023
1 parent f219e16 commit f0180f4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/extraction_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from funcchain import BaseModel, chain
from funcchain import BaseModel, achain, chain


class Task(BaseModel):
Expand All @@ -18,11 +18,11 @@ def description(task: Task) -> str:
return chain()


def extract_task(task_description: Task) -> Task:
async def extract_task(task_description: Task) -> Task:
"""
EXTRACT TASK: {task_description}
"""
return chain()
return await achain()


def compare_tasks(task: Task, task2: Task) -> bool:
Expand All @@ -37,6 +37,8 @@ def compare_tasks(task: Task, task2: Task) -> bool:


def test_extraction():
from asyncio import run as _await

task = Task(
name="Do dishes",
description="Do the dishes in the kitchen.",
Expand All @@ -45,7 +47,7 @@ def test_extraction():
)

task_description = description(task)
task2 = extract_task(task_description)
task2 = _await(extract_task(task_description))

assert compare_tasks(task, task2)

Expand Down

0 comments on commit f0180f4

Please sign in to comment.