Skip to content

Commit

Permalink
Add test for wrong node type
Browse files Browse the repository at this point in the history
  • Loading branch information
kmlefran committed Jan 23, 2024
1 parent 817a8ab commit 8e42df2
Show file tree
Hide file tree
Showing 8 changed files with 1,869 additions and 3 deletions.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ dependencies = [
"ase",
"cclib",
"aiida-dataframe",
"multiprocess"
"multiprocess",
"subproptools",
"group_decomposition"
]

[project.urls]
Expand All @@ -52,6 +54,7 @@ testing = [
"cclib",
"aiida-dataframe",
"multiprocess",
"subproptools",
"pymatgen",
"coveralls"
]
Expand Down
3 changes: 3 additions & 0 deletions tests/data/test_aimqbparameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def test_data():
AimqbParameters = DataFactory("aimall.aimqb")
parameters = AimqbParameters({"naat": 2, "nproc": 2, "atlaprhocps": True})
assert isinstance(parameters, AimqbParameters)
assert isinstance(
parameters.__str__(), str # pylint:disable=unnecessary-dunder-call
) # pylint:disable=unnecessary-dunder-call
# file = SinglefileData(
# file=os.path.join(TEST_DIR, "input_files", "water_wb97xd_augccpvtz_qtaim.wfx")
# )
Expand Down
830 changes: 830 additions & 0 deletions tests/parsers/fixtures/aimall.gaussianwfx/default/aiida.sum

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Title Card Required
H1
Auto
Critical Point Data
1 0 0
4.25140469099550E-17 0.00000000000000E+00 1.56271704054169E-17 H2
0 0
Options
Integer 1
42 1
Real 0

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Title Card Required
H2
Auto
Critical Point Data
1 0 0
4.25140469099550E-17 0.00000000000000E+00 1.56271704054169E-17 H1
0 0
Options
Integer 1
42 1
Real 0

Large diffs are not rendered by default.

28 changes: 26 additions & 2 deletions tests/parsers/test_aimqbbaseparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest

# from aiida import orm
from aiida.common import AttributeDict
from aiida.common import AttributeDict, exceptions
from aiida.orm import SinglefileData

from aiida_aimall.data import AimqbParameters
Expand All @@ -18,7 +18,7 @@ def generate_aimqb_inputs():

def _generate_aimqb_inputs(fixture_code, filepath_tests):
"""Return only those inputs the parser will expect to be there"""
parameters = AimqbParameters({"naat": 2, "nproc": 2})
parameters = AimqbParameters({"naat": 2, "nproc": 2, "atlaprhocps": True})
inputs = {
"code": fixture_code("aimall"),
"parameters": parameters,
Expand Down Expand Up @@ -73,3 +73,27 @@ def test_aimqb_parser_default( # pylint:disable=too-many-arguments
results_dict = results["output_parameters"].get_dict()
assert "atomic_properties" in results_dict
assert "bcp_properties" in results_dict


def test_gaussiannode_returns_error( # pylint:disable=too-many-arguments
fixture_localhost,
generate_calc_job_node,
fixture_code,
filepath_tests,
generate_parser,
generate_aimqb_inputs,
):
"""Test that a Gaussian node returns error on parser"""
entry_point_calc_job = "aimall.gaussianwfx"
entry_point_parser = "aimall.base"
name = "default"
node = generate_calc_job_node(
entry_point_calc_job,
fixture_localhost,
name,
generate_aimqb_inputs(fixture_code, filepath_tests),
)
parser = generate_parser(entry_point_parser)
with pytest.raises(exceptions.ParsingError) as excinfo:
parser.parse_from_node(node, store_provenance=False)
assert str(excinfo.value) == "Can only parse AimqbCalculation"

0 comments on commit 8e42df2

Please sign in to comment.