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

Method test_when_decorator

core/tests/python/tests/test_web.py:587–607  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

585 skip_when=RUNNING_IN_WORKER and not upytest.is_micropython,
586 )
587 async def test_when_decorator(self):
588 called = False
589 call_flag = asyncio.Event()
590
591 buttons_collection = web.page.find("button")
592
593 @when("click", buttons_collection)
594 def on_click(event):
595 nonlocal called
596 called = True
597 call_flag.set()
598
599 # Now let's simulate a click on the button (using the low level JS API)
600 # so we don't risk dom getting in the way
601 assert not called
602 for button in buttons_collection:
603 button._dom_element.click()
604 await call_flag.wait()
605 assert called
606 called = False
607 call_flag.clear()
608
609 def test_update_all_single_attribute(self):
610 """Test updating single attribute on all elements."""

Callers

nothing calls this directly

Calls 2

findMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected