Skip to content

Commit

Permalink
Fix all but one test - in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
edan-bainglass committed Nov 14, 2024
1 parent 79810a1 commit 20ea2d1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 29 deletions.
44 changes: 21 additions & 23 deletions tests/test_plugins_bands.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ def test_result(generate_qeapp_workchain):
model = widget._model

assert isinstance(widget, BandPdosWidget)

widget.plot_button.click()
assert isinstance(widget.plot, go.FigureWidget)

# Check if data is correct
Expand All @@ -31,24 +29,24 @@ def test_result(generate_qeapp_workchain):
assert model.bands_data["pathlabels"][0] == list(widget.plot.layout.xaxis.ticktext) # type: ignore


# def test_structure_1d(generate_qeapp_workchain, generate_structure_data):
# structure = generate_structure_data("silicon", pbc=(True, False, False))
# workchain = generate_qeapp_workchain(structure=structure)
# assert "bands_kpoints_distance" not in workchain.inputs.bands.bands
# assert "bands_kpoints" in workchain.inputs.bands.bands
# assert len(workchain.inputs.bands.bands.bands_kpoints.labels) == 2
# assert workchain.inputs.bands.bands.bands_kpoints.labels == [(0, "Γ"), (9, "X")]


# def test_structure_2d(generate_qeapp_workchain, generate_structure_data):
# structure = generate_structure_data("MoS2", pbc=(True, True, False))
# workchain = generate_qeapp_workchain(structure=structure)
# assert "bands_kpoints_distance" not in workchain.inputs.bands.bands
# assert "bands_kpoints" in workchain.inputs.bands.bands
# assert len(workchain.inputs.bands.bands.bands_kpoints.labels) == 4
# assert workchain.inputs.bands.bands.bands_kpoints.labels == [
# (0, "Γ"),
# (11, "M"),
# (18, "K"),
# (31, "Γ"),
# ]
def test_structure_1d(generate_qeapp_workchain, generate_structure_data):
structure = generate_structure_data("silicon", pbc=(True, False, False))
workchain = generate_qeapp_workchain(structure=structure)
assert "bands_kpoints_distance" not in workchain.inputs.bands.bands
assert "bands_kpoints" in workchain.inputs.bands.bands
assert len(workchain.inputs.bands.bands.bands_kpoints.labels) == 2
assert workchain.inputs.bands.bands.bands_kpoints.labels == [(0, "Γ"), (9, "X")]


def test_structure_2d(generate_qeapp_workchain, generate_structure_data):
structure = generate_structure_data("MoS2", pbc=(True, True, False))
workchain = generate_qeapp_workchain(structure=structure)
assert "bands_kpoints_distance" not in workchain.inputs.bands.bands
assert "bands_kpoints" in workchain.inputs.bands.bands
assert len(workchain.inputs.bands.bands.bands_kpoints.labels) == 4
assert workchain.inputs.bands.bands.bands_kpoints.labels == [
(0, "Γ"),
(11, "M"),
(18, "K"),
(31, "Γ"),
]
2 changes: 0 additions & 2 deletions tests/test_plugins_electronic_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ def test_electronic_structure(generate_qeapp_workchain):
model = widget._model

assert isinstance(widget, BandPdosWidget)

widget.plot_button.click()
assert isinstance(widget.plot, go.FigureWidget)

# Check if data is correct
Expand Down
2 changes: 0 additions & 2 deletions tests/test_plugins_pdos.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ def test_result(generate_qeapp_workchain):
model = widget._model

assert isinstance(widget, BandPdosWidget)

widget.plot_button.click()
assert isinstance(widget.plot, go.FigureWidget)

# Check if data is correct
Expand Down
5 changes: 3 additions & 2 deletions tests/test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from aiidalab_qe.app.main import App
from aiidalab_qe.app.result.summary import WorkChainSummaryModel
from aiidalab_qe.app.result.viewer import WorkChainViewer
from aiidalab_qe.app.result.viewer import WorkChainViewer, WorkChainViewerModel


def test_result_step(app_to_submit, generate_qeapp_workchain):
Expand Down Expand Up @@ -32,7 +32,8 @@ def test_workchainview(generate_qeapp_workchain):

workchain = generate_qeapp_workchain()
workchain.node.seal()
viewer = WorkChainViewer(workchain.node)
model = WorkChainViewerModel()
viewer = WorkChainViewer(workchain.node, model=model)
time.sleep(3)
assert len(viewer.tabs.children) == 5
assert viewer.tabs._titles["0"] == "Workflow Summary" # type: ignore
Expand Down

0 comments on commit 20ea2d1

Please sign in to comment.