From 0a19a48616a419bfe3dcd193e3e1d33e35c5712d Mon Sep 17 00:00:00 2001 From: Shyue Ping Ong Date: Tue, 20 Jun 2023 07:57:12 -0700 Subject: [PATCH] Improve doc of tests. --- tests/conftest.py | 13 +++++++------ tests/models/test_megnet.py | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index fe723709..29e7f8d6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,8 +1,8 @@ """ -Define commonly used text fixtures. -- Fixtures that are formulae (e.g., LiFePO4) essentially returns the appropriate pymatgen Structure or Molecule based - on the most common known structure. -- Fixtures that are prefixed with a graph returns a (structure, graph, state) tuple. +Define commonly used text fixtures. These are meant to be reused in unittests. +- Fixtures that are formulae (e.g., LiFePO4) returns the appropriate pymatgen Structure or Molecule based on the most + commonly known structure. +- Fixtures that are prefixed with `graph_` returns a (structure, graph, state) tuple. Given that the fixtures are unlikely to be modified by the underlying code, the fixtures are set with a scope of "session". In the event that future tests are written that modifies the fixtures, these can be set to the default scope @@ -20,8 +20,10 @@ def get_graph(structure, cutoff): """ + Helper class to generate DGL graph from an input Structure or Molecule. + Returns: - Structure, Graph, State + Structure/Molecule, Graph, State """ element_types = get_element_list([structure]) if isinstance(structure, Structure): @@ -79,7 +81,6 @@ def graph_CH4(CH4): Returns: Molecule, Graph, State """ - return get_graph(CH4, 2.0) diff --git a/tests/models/test_megnet.py b/tests/models/test_megnet.py index 0f8f907d..1a403831 100644 --- a/tests/models/test_megnet.py +++ b/tests/models/test_megnet.py @@ -8,7 +8,7 @@ from matgl.models import MEGNet -class TestMEGNetTest: +class TestMEGNet: def test_megnet(self, graph_MoS): structure, graph, state = graph_MoS model = MEGNet(