未提供项目描述
项目描述
使用playwright和pytest测试ipywidgets。
安装
pip install "pytest-ipywidgets[all]"
(注意,可选的[all]
会安装所有依赖项,包括notebook、jupyterlab和voila的兼容版本。)
用法
使用solara-server(进程内)
如果您想使用playwright在进程内测试ipywidgets,您可以使用solara_test
fixture,使用display
在浏览器中显示您的小部件。
import ipywidgets as widgets
import playwright.sync_api
from IPython.display import display
def test_widget_button_solara(solara_test, page_session: playwright.sync_api.Page):
# this all runs in-process
button = widgets.Button(description="Click Me!")
def change_description(obj):
button.description = "Tested event"
button.on_click(change_description)
display(button)
button_sel = page_session.locator("text=Click Me!")
button_sel.wait_for()
button_sel.click()
page_session.locator("text=Tested event").wait_for()
在主要Jupyter环境中进行测试(Notebook、Lab、Voila & Solara)
有关更多信息,请参阅https://solara.dev/documentation/advanced/howto/testing。
项目详情
关闭
pytest_ipywidgets-1.39.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 4ca4882c74baafeaa1fb144e454730cb8d5a91b0df736129cc568082fc1a6be2 |
|
MD5 | 7fd3803410ccd299c278e6770c2564ee |
|
BLAKE2b-256 | 606d1bbc85fa81549fe481b06a7a4a6e69bb5a4525e733bfef208692ed11774f |
关闭
pytest_ipywidgets-1.39.0-py2.py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | cb632bd730aa45991706f32691243c21a97b0a6a41561edcf29acdb0c37278db |
|
MD5 | 11202cb0ae4182f75c9615961c10378a |
|
BLAKE2b-256 | 0451dc7d8bf74c31c0dc21e01e8cf4e605d1d2a2e3f8e332d0d2c8900b8683ae |