Skip to content
Snippets Groups Projects
Commit 28b4c891 authored by Nathan Daelman's avatar Nathan Daelman
Browse files

Add tester libxc parser

parent b0685276
No related branches found
No related tags found
No related merge requests found
from typing import Any
import pytest
from general_parser import Triple, get_libxc_settings
from libxc_c_parser import libxc_main, trampoline
def libxc_src() -> str:
main, _, src = get_libxc_settings()
return f"{main}/{src}"
def source_file(file_name: str) -> list[Triple]:
file_path = f"{libxc_src()}/{file_name}"
with open(file_path, "r", encoding="utf-8") as file:
_, _, posts = trampoline(libxc_main, file, "", [])
return posts
@pytest.mark.parametrize(
"file_name, expected",
[
(
"gga_x_pbe.c",
{
"post_id": 0,
"name": "XC_GGA_X_PBE",
"citations": ["&xc_ref_Perdew1996_3865", "&xc_ref_Perdew1997_1396"],
"initializer": "gga_x_pbe_init",
},
),
# Add more file_name and expected dicts for additional files
],
)
def test_functional(file_name, expected):
functional_attr = source_file(file_name)[expected["post_id"]][1][1]
for key, value in expected.items():
assert functional_attr[key] == value
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment