diff --git a/tests/cases.py b/tests/cases.py
index 0cde14f..095aa78 100644
--- a/tests/cases.py
+++ b/tests/cases.py
@@ -17,6 +17,7 @@ class ReferenceCase:
expected_markdown: str
pmid: int | None = None
arxiv: str | None = None
+ skip_reason: str | None = None
@property
def expected_text(self) -> str:
@@ -390,82 +391,83 @@ def expected_text(self) -> str:
expected_markdown=r"Jinzhe Zeng, Linfeng Zhang, Han Wang, Tong Zhu, Exploring the Chemical Space of Linear Alkane Pyrolysis via Deep Potential GENerator, *Energy Fuels*, 2021, 35, 762-769, DOI: [10.1021/acs.energyfuels.0c03211](https://doi.org/10.1021/acs.energyfuels.0c03211). [](https://badge.dimensions.ai/details/doi/10.1021/acs.energyfuels.0c03211)",
),
# ChemRxiv
- # ReferenceCase(
- # reference=Reference(
- # author=[
- # Author(first="Manyi", last="Yang"),
- # Author(first="Duo", last="Zhang"),
- # Author(first="Xinyan", last="Wang"),
- # # why not Linfeng???
- # Author(first="Lingfeng", last="Zhang"),
- # Author(first="Tong", last="Zhu"),
- # Author(first="Han", last="Wang"),
- # ],
- # title="Ab initio Accuracy Neural Network Potential for Drug-like Molecules",
- # journal="ChemRxiv",
- # year=2024,
- # annote=textwrap.dedent("""\
- # The advent of machine learning
- # (ML) in computational chemistry heralds a transformative approach to
- # one of the quintessential challenges in computer-aided drug design
- # (CADD): the accurate and cost-effective calculation of atomic
- # interactions. By leveraging a neural network (NN) potential, we
- # address this balance and push the boundaries of the NN potential's
- # representational capacity. Our work details the development of a
- # robust general-purpose NN potential, architected on the framework of
- # DPA-2, a deep learning potential with attention, which demonstrates
- # remarkable fidelity in replicating the interatomic potential energy
- # surface for drug-like molecules comprising eight critical chemical
- # elements: H, C, N, O, F, S, Cl, and P. We employed state-of-the-art
- # molecular dynamic techniques, including temperature acceleration and
- # enhanced sampling, to construct a comprehensive dataset to ensure
- # exhaustive coverage of relevant configurational spaces. Our rigorous
- # testing protocols, including torsion scanning, global minimum
- # searches, and high-temperature MD simulations across various organic
- # molecules, have culminated in an NN model that achieves chemical
- # precision commensurate with the highly regarded DFT model, while
- # significantly outstripping the accuracy of prevalent semi-empirical
- # methods. This study presents a leap forward in the predictive
- # modelling of molecular interactions, offering extensive applications
- # in drug development and beyond.
- # """)
- # .strip()
- # .replace("\n", " "),
- # doi="10.26434/chemrxiv-2024-sq8nh",
- # ),
- # expected_bibtex=textwrap.dedent(r"""
- # @Article{Yang_ChemRxiv_2024,
- # author = {Manyi Yang and Duo Zhang and Xinyan Wang and Lingfeng Zhang and Tong
- # Zhu and Han Wang},
- # title = {{Ab initio Accuracy Neural Network Potential for Drug-like Molecules}},
- # journal = {ChemRxiv},
- # year = 2024,
- # doi = {10.26434/chemrxiv-2024-sq8nh},
- # abstract = {The advent of machine learning (ML) in computational chemistry heralds
- # a transformative approach to one of the quintessential challenges in
- # computer-aided drug design (CADD): the accurate and cost-effective
- # calculation of atomic interactions. By leveraging a neural network
- # (NN) potential, we address this balance and push the boundaries of the
- # NN potential's representational capacity. Our work details the
- # development of a robust general-purpose NN potential, architected on
- # the framework of DPA-2, a deep learning potential with attention,
- # which demonstrates remarkable fidelity in replicating the interatomic
- # potential energy surface for drug-like molecules comprising eight
- # critical chemical elements: H, C, N, O, F, S, Cl, and P. We employed
- # state-of-the-art molecular dynamic techniques, including temperature
- # acceleration and enhanced sampling, to construct a comprehensive
- # dataset to ensure exhaustive coverage of relevant configurational
- # spaces. Our rigorous testing protocols, including torsion scanning,
- # global minimum searches, and high-temperature MD simulations across
- # various organic molecules, have culminated in an NN model that
- # achieves chemical precision commensurate with the highly regarded DFT
- # model, while significantly outstripping the accuracy of prevalent
- # semi-empirical methods. This study presents a leap forward in the
- # predictive modelling of molecular interactions, offering extensive
- # applications in drug development and beyond.},
- # }""").strip(),
- # expected_markdown=r"Manyi Yang, Duo Zhang, Xinyan Wang, Lingfeng Zhang, Tong Zhu, Han Wang, Ab initio Accuracy Neural Network Potential for Drug-like Molecules, *ChemRxiv*, 2024, DOI: [10.26434/chemrxiv-2024-sq8nh](https://doi.org/10.26434/chemrxiv-2024-sq8nh). [](https://badge.dimensions.ai/details/doi/10.26434/chemrxiv-2024-sq8nh)",
- # ),
+ ReferenceCase(
+ reference=Reference(
+ author=[
+ Author(first="Manyi", last="Yang"),
+ Author(first="Duo", last="Zhang"),
+ Author(first="Xinyan", last="Wang"),
+ # why not Linfeng???
+ Author(first="Lingfeng", last="Zhang"),
+ Author(first="Tong", last="Zhu"),
+ Author(first="Han", last="Wang"),
+ ],
+ title="Ab initio Accuracy Neural Network Potential for Drug-like Molecules",
+ journal="ChemRxiv",
+ year=2024,
+ annote=textwrap.dedent("""\
+ The advent of machine learning
+ (ML) in computational chemistry heralds a transformative approach to
+ one of the quintessential challenges in computer-aided drug design
+ (CADD): the accurate and cost-effective calculation of atomic
+ interactions. By leveraging a neural network (NN) potential, we
+ address this balance and push the boundaries of the NN potential's
+ representational capacity. Our work details the development of a
+ robust general-purpose NN potential, architected on the framework of
+ DPA-2, a deep learning potential with attention, which demonstrates
+ remarkable fidelity in replicating the interatomic potential energy
+ surface for drug-like molecules comprising eight critical chemical
+ elements: H, C, N, O, F, S, Cl, and P. We employed state-of-the-art
+ molecular dynamic techniques, including temperature acceleration and
+ enhanced sampling, to construct a comprehensive dataset to ensure
+ exhaustive coverage of relevant configurational spaces. Our rigorous
+ testing protocols, including torsion scanning, global minimum
+ searches, and high-temperature MD simulations across various organic
+ molecules, have culminated in an NN model that achieves chemical
+ precision commensurate with the highly regarded DFT model, while
+ significantly outstripping the accuracy of prevalent semi-empirical
+ methods. This study presents a leap forward in the predictive
+ modelling of molecular interactions, offering extensive applications
+ in drug development and beyond.
+ """)
+ .strip()
+ .replace("\n", " "),
+ doi="10.26434/chemrxiv-2024-sq8nh",
+ ),
+ expected_bibtex=textwrap.dedent(r"""
+ @Article{Yang_ChemRxiv_2024,
+ author = {Manyi Yang and Duo Zhang and Xinyan Wang and Lingfeng Zhang and Tong
+ Zhu and Han Wang},
+ title = {{Ab initio Accuracy Neural Network Potential for Drug-like Molecules}},
+ journal = {ChemRxiv},
+ year = 2024,
+ doi = {10.26434/chemrxiv-2024-sq8nh},
+ abstract = {The advent of machine learning (ML) in computational chemistry heralds
+ a transformative approach to one of the quintessential challenges in
+ computer-aided drug design (CADD): the accurate and cost-effective
+ calculation of atomic interactions. By leveraging a neural network
+ (NN) potential, we address this balance and push the boundaries of the
+ NN potential's representational capacity. Our work details the
+ development of a robust general-purpose NN potential, architected on
+ the framework of DPA-2, a deep learning potential with attention,
+ which demonstrates remarkable fidelity in replicating the interatomic
+ potential energy surface for drug-like molecules comprising eight
+ critical chemical elements: H, C, N, O, F, S, Cl, and P. We employed
+ state-of-the-art molecular dynamic techniques, including temperature
+ acceleration and enhanced sampling, to construct a comprehensive
+ dataset to ensure exhaustive coverage of relevant configurational
+ spaces. Our rigorous testing protocols, including torsion scanning,
+ global minimum searches, and high-temperature MD simulations across
+ various organic molecules, have culminated in an NN model that
+ achieves chemical precision commensurate with the highly regarded DFT
+ model, while significantly outstripping the accuracy of prevalent
+ semi-empirical methods. This study presents a leap forward in the
+ predictive modelling of molecular interactions, offering extensive
+ applications in drug development and beyond.},
+ }""").strip(),
+ expected_markdown=r"Manyi Yang, Duo Zhang, Xinyan Wang, Lingfeng Zhang, Tong Zhu, Han Wang, Ab initio Accuracy Neural Network Potential for Drug-like Molecules, *ChemRxiv*, 2024, DOI: [10.26434/chemrxiv-2024-sq8nh](https://doi.org/10.26434/chemrxiv-2024-sq8nh). [](https://badge.dimensions.ai/details/doi/10.26434/chemrxiv-2024-sq8nh)",
+ skip_reason="ChemRxiv API broken",
+ ),
# chapter
ReferenceCase(
reference=Reference(
diff --git a/tests/test_from_identifier.py b/tests/test_from_identifier.py
index 959a66c..5c402d7 100644
--- a/tests/test_from_identifier.py
+++ b/tests/test_from_identifier.py
@@ -6,21 +6,35 @@
from wenxian.from_identifier import from_identifier
-from .cases import TEST_CASES
+from .cases import TEST_CASES, ReferenceCase
+
+
+def _create_test_param(test_case: ReferenceCase, identifier: str | None):
+ """Create a pytest.param with skip marks if needed."""
+ return pytest.param(
+ identifier,
+ test_case.reference,
+ marks=pytest.mark.skip(reason=test_case.skip_reason)
+ if test_case.skip_reason
+ else (),
+ )
@pytest.mark.parametrize(
"identifier, expected",
[
- *[(test_case.reference.doi, test_case.reference) for test_case in TEST_CASES],
+ *[
+ _create_test_param(test_case, test_case.reference.doi)
+ for test_case in TEST_CASES
+ ],
*[
# from_identifier accept str
- (str(test_case.pmid), test_case.reference)
+ _create_test_param(test_case, str(test_case.pmid))
for test_case in TEST_CASES
if test_case.pmid is not None
],
*[
- (test_case.arxiv, test_case.reference)
+ _create_test_param(test_case, test_case.arxiv)
for test_case in TEST_CASES
if test_case.arxiv is not None
],
diff --git a/tests/test_output.py b/tests/test_output.py
index a4c6a83..ea6ad74 100644
--- a/tests/test_output.py
+++ b/tests/test_output.py
@@ -6,14 +6,26 @@
import pytest
-from .cases import TEST_CASES
+from .cases import TEST_CASES, ReferenceCase
if TYPE_CHECKING:
from wenxian.reference import Reference
+def _create_test_param(test_case: ReferenceCase, expected_value: str):
+ """Create a pytest.param with skip marks if needed."""
+ return pytest.param(
+ test_case.reference,
+ expected_value,
+ marks=pytest.mark.skip(reason=test_case.skip_reason)
+ if test_case.skip_reason
+ else (),
+ )
+
+
@pytest.mark.parametrize(
- "reference, expected", [(cc.reference, cc.expected_bibtex) for cc in TEST_CASES]
+ "reference, expected",
+ [_create_test_param(cc, cc.expected_bibtex) for cc in TEST_CASES],
)
def test_bibtex(reference: Reference, expected):
"""Test generating BibTeX entries from references."""
@@ -21,7 +33,8 @@ def test_bibtex(reference: Reference, expected):
@pytest.mark.parametrize(
- "reference, expected", [(cc.reference, cc.expected_markdown) for cc in TEST_CASES]
+ "reference, expected",
+ [_create_test_param(cc, cc.expected_markdown) for cc in TEST_CASES],
)
def test_markdown(reference: Reference, expected):
"""Test generating Markdown from references."""
@@ -29,7 +42,8 @@ def test_markdown(reference: Reference, expected):
@pytest.mark.parametrize(
- "reference, expected", [(cc.reference, cc.expected_text) for cc in TEST_CASES]
+ "reference, expected",
+ [_create_test_param(cc, cc.expected_text) for cc in TEST_CASES],
)
def test_text(reference: Reference, expected):
"""Test generating text from references."""