Skip to content

Commit

Permalink
fix extension tests
Browse files Browse the repository at this point in the history
  • Loading branch information
spyoungtech committed Aug 30, 2023
1 parent 3eba8b8 commit aa6afec
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
15 changes: 10 additions & 5 deletions tests/_async/test_extensions.py
@@ -1,4 +1,6 @@
import asyncio
import random
import string
import time
import unittest

Expand All @@ -11,19 +13,22 @@

sleep = time.sleep

ext_text = '''\
AHKDoSomething(ByRef command) {
function_name = 'AHKDoSomething'
function_name = 'AAHKDoSomething' # unasync: remove

ext_text = f'''\
{function_name}(ByRef command) {{
arg := command[2]
return FormatResponse("ahk.message.StringResponseMessage", Format("test{}", arg))
}
return FormatResponse("ahk.message.StringResponseMessage", Format("test{{}}", arg))
}}
'''

async_extension = Extension(script_text=ext_text)


@async_extension.register
async def do_something(ahk, arg: str) -> str:
res = await ahk.function_call('AHKDoSomething', [arg])
res = await ahk.function_call(function_name, [arg])
return res


Expand Down
14 changes: 9 additions & 5 deletions tests/_sync/test_extensions.py
@@ -1,4 +1,6 @@
import asyncio
import random
import string
import time
import unittest

Expand All @@ -10,19 +12,21 @@

sleep = time.sleep

ext_text = '''\
AHKDoSomething(ByRef command) {
function_name = 'AHKDoSomething'

ext_text = f'''\
{function_name}(ByRef command) {{
arg := command[2]
return FormatResponse("ahk.message.StringResponseMessage", Format("test{}", arg))
}
return FormatResponse("ahk.message.StringResponseMessage", Format("test{{}}", arg))
}}
'''

async_extension = Extension(script_text=ext_text)


@async_extension.register
def do_something(ahk, arg: str) -> str:
res = ahk.function_call('AHKDoSomething', [arg])
res = ahk.function_call(function_name, [arg])
return res


Expand Down

0 comments on commit aa6afec

Please sign in to comment.