Skip to content

Commit

Permalink
TST #90 test top-level in customwidgets
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed May 17, 2022
1 parent 18f9394 commit 9b7c5f6
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion adl2pydm/tests/test_output_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,27 @@ def test_write_all_example_files_process(test_file, tempdir):
assert os.path.exists(full_uiname), uiname


@pytest.mark.parametrize("test_file", _core.ALL_EXAMPLE_FILES)
def test_write_top_level_widget(test_file, tempdir):
uiname = _core.convertAdlFile("table_setup_SRI.adl", tempdir)
full_uiname = os.path.join(tempdir, uiname)
root = ElementTree.parse(full_uiname).getroot()

widgets = _core.getSubElement(root, "widget")
assert len(widgets) > 0
widget_classes = [
w.attrib.get("class")
for w in widgets
if w.attrib.get("class") is not None
]
assert output_handler.TOP_LEVEL_WIDGET_CLASS in widget_classes

customwidgets = _core.getSubElement(root, "customwidgets")
widgets = customwidgets.findall("customwidget")
customs = [_core.getSubElement(w, "class").text for w in widgets]
assert output_handler.TOP_LEVEL_WIDGET_CLASS in customs


def test_write_extends_customwidget(tempdir):
uiname = _core.convertAdlFile("table_setup_SRI.adl", tempdir)
full_uiname = os.path.join(tempdir, uiname)
Expand Down Expand Up @@ -241,7 +262,8 @@ def test_write_widget_composite(tempdir):

key = "composite"
widget = _core.getNamedWidget(screen, key)
_core.assertEqualClassName(widget, "PyDMFrame", key)
# _core.assertEqualClassName(widget, "PyDMFrame", key)
_core.assertEqualClassName(widget, output_handler.TOP_LEVEL_WIDGET_CLASS, key)
_core.assertEqual(len(widget), 6)


Expand Down

0 comments on commit 9b7c5f6

Please sign in to comment.