Skip to content

Commit b8267fc

Browse files
committed
🔧 Refactor async tests to use simplified asyncio syntax
1 parent 7986c72 commit b8267fc

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/chain_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import asyncio
1+
from asyncio import run as _await
22

33
from codeinterpreterapi.chains import (
44
aget_file_modifications,
@@ -38,9 +38,9 @@ def test_remove_download_link() -> None:
3838
)
3939

4040

41-
async def test_remove_download_link_async() -> None:
41+
def test_remove_download_link_async() -> None:
4242
assert (
43-
await aremove_download_link(remove_download_link_example, llm=llm)
43+
_await(aremove_download_link(remove_download_link_example, llm=llm))
4444
).strip() == "I have created the plot to your dataset."
4545

4646

@@ -49,13 +49,13 @@ def test_get_file_modifications() -> None:
4949
assert get_file_modifications(code_no_mod, llm=llm) == []
5050

5151

52-
async def test_get_file_modifications_async() -> None:
53-
assert await aget_file_modifications(code_with_mod, llm=llm) == ["plot.png"]
54-
assert await aget_file_modifications(code_no_mod, llm=llm) == []
52+
def test_get_file_modifications_async() -> None:
53+
assert _await(aget_file_modifications(code_with_mod, llm=llm)) == ["plot.png"]
54+
assert _await(aget_file_modifications(code_no_mod, llm=llm)) == []
5555

5656

5757
if __name__ == "__main__":
5858
test_remove_download_link()
59-
asyncio.run(test_remove_download_link_async())
59+
test_remove_download_link_async()
6060
test_get_file_modifications()
61-
asyncio.run(test_get_file_modifications_async())
61+
test_get_file_modifications_async()

0 commit comments

Comments
 (0)