Skip to content

Commit

Permalink
Add test for nomad parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
domna committed Jul 4, 2024
1 parent 6550886 commit 2ffe221
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/pynxtools/testing/nexus_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
from glob import glob
from typing import Literal

try:
from nomad.client import parse

NOMAD_AVAILABE = True
except ImportError:
NOMAD_AVAILABLE = False


from pynxtools.dataconverter.convert import get_reader, transfer_data_into_template
from pynxtools.dataconverter.helpers import get_nxdl_root_and_path
from pynxtools.dataconverter.validation import validate_dict_against
Expand Down Expand Up @@ -109,6 +117,17 @@ def convert_to_nexus(

Writer(read_data, nxdl_file, self.created_nexus).write()

if NOMAD_AVAILABLE:
kwargs = dict(
strict=True,
parser_name=None,
server_context=False,
username=None,
password=None,
)

parse(self.created_nexus, **kwargs)

def check_reproducibility_of_nexus(self):
"""Reproducibility test for the generated nexus file."""
IGNORE_LINES = [
Expand Down

0 comments on commit 2ffe221

Please sign in to comment.