From eeb00a352ed77beadcc38fed66ddfaa5e6d24131 Mon Sep 17 00:00:00 2001 From: Aliaksandr Yakutovich Date: Fri, 3 Nov 2023 15:38:14 +0100 Subject: [PATCH] Extend documentation for the `viewers` module (#515) --- docs/source/widget-list/index.rst | 2 +- notebooks/aiida_datatypes_viewers.ipynb | 251 --------------- notebooks/viewers.ipynb | 410 ++++++++++++++++++++++++ tests_notebooks/test_notebooks.py | 3 +- 4 files changed, 412 insertions(+), 254 deletions(-) delete mode 100644 notebooks/aiida_datatypes_viewers.ipynb create mode 100644 notebooks/viewers.ipynb diff --git a/docs/source/widget-list/index.rst b/docs/source/widget-list/index.rst index 71ca43782..d967edbf6 100644 --- a/docs/source/widget-list/index.rst +++ b/docs/source/widget-list/index.rst @@ -11,7 +11,7 @@ See also the `corresponding git repository {node.value}'\n", + "\n", + "vwr = viewer(orm.Int(3).store())\n", + "display(vwr)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The string to be put as an argument of the `register_viewer_widget` decorator can be obtained from the `node_type` property of an object." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "i_node = orm.Int(1)\n", + "print(i_node.node_type)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.13" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/tests_notebooks/test_notebooks.py b/tests_notebooks/test_notebooks.py index 2cec668c6..0207d8820 100644 --- a/tests_notebooks/test_notebooks.py +++ b/tests_notebooks/test_notebooks.py @@ -17,11 +17,10 @@ def test_process_list(selenium_driver, final_screenshot): def test_aiida_datatypes_viewers(selenium_driver, final_screenshot): - driver = selenium_driver("notebooks/aiida_datatypes_viewers.ipynb") + driver = selenium_driver("notebooks/viewers.ipynb") driver.set_window_size(1000, 2000) driver.find_element(By.CLASS_NAME, "widget-label") driver.find_element(By.XPATH, '//button[text()="Clear selection"]') - driver.find_element(By.XPATH, '//p[text()="Warning:"]') time.sleep(5)