generated from FAIRmat-NFDI/nomad-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca0f78d
commit 41d5331
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
tests/data/processed_reactions/paper_0_reaction_1.archive.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
data: | ||
extracted_json_data: paper_0.json | ||
m_def: nomad_polymerization_reactions.schema_packages.mypackage.PolymerizationReaction | ||
monomers: | ||
- smiles: C=C | ||
substance_name: ethylene | ||
- smiles: C=O | ||
substance_name: carbon monoxide | ||
publication_reference: | ||
DOI_number: https://doi.org/10.1002/pol.1963.110010415 | ||
reaction_conditions: | ||
method: bulk | ||
temperature: 293.15 |
16 changes: 16 additions & 0 deletions
16
tests/data/processed_reactions/paper_5_reaction_1.archive.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
data: | ||
extracted_json_data: paper_5.json | ||
logP: 0.38710000000000006 | ||
m_def: nomad_polymerization_reactions.schema_packages.mypackage.PolymerizationReaction | ||
monomers: | ||
- smiles: C=C(C)C(=O)OC | ||
substance_name: Methyl Methacrylate | ||
- smiles: C=C(C)C(=O)O | ||
substance_name: Methacrylic Acid | ||
publication_reference: | ||
DOI_number: https://doi.org/10.1016/0014-3057(94)00111-1 | ||
reaction_conditions: | ||
method: solvent | ||
solvent: | ||
name: CC(C)O | ||
temperature: 343.15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
|
||
import pytest | ||
import yaml | ||
from nomad_polymerization_reactions.utils import generate_archive_from_llm_output | ||
|
||
|
||
@pytest.mark.parametrize( | ||
'params', | ||
[ | ||
{ | ||
'filepath': 'tests/data/processed_reactions/paper_0_reaction_1.json', | ||
'reference': 'tests/data/processed_reactions/paper_0_reaction_1.archive.yaml', | ||
}, | ||
{ | ||
'filepath': 'tests/data/processed_reactions/paper_5_reaction_1.json', | ||
'reference': 'tests/data/processed_reactions/paper_5_reaction_1.archive.yaml', | ||
}, | ||
], | ||
) | ||
def test_generate_archive_from_llm_output(params): | ||
output = generate_archive_from_llm_output(params['filepath']) | ||
with open(params['reference']) as f: | ||
reference = yaml.load(f, Loader=yaml.FullLoader) | ||
assert output == reference | ||
|
||
# remove the generated file | ||
generated_file = f'{params["filepath"].split("/")[-1].split(".")[0]}.archive.yaml' | ||
os.remove(generated_file) |