MCPcopy Index your code
hub / github.com/pyscript/pyscript / test_worker_exported_functions

Function test_worker_exported_functions

core/tests/python/tests/test_workers.py:35–49  ·  view source on GitHub ↗

Functions exported from a worker should be callable.

()

Source from the content-addressed store, hash-verified

33
34@upytest.skip("Main thread only", skip_when=RUNNING_IN_WORKER)
35async def test_worker_exported_functions():
36 """
37 Functions exported from a worker should be callable.
38 """
39 from pyscript import workers
40
41 worker = await workers["testworker"]
42 # Test multiple exported functions.
43 add_result = await worker.add(10, 20)
44 multiply_result = await worker.multiply(4, 5)
45 greeting = await worker.get_message()
46
47 assert add_result == 30
48 assert multiply_result == 20
49 assert greeting == "Hello from worker"
50
51
52@upytest.skip("Main thread only", skip_when=RUNNING_IN_WORKER)

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected