File: test_optimade.py

package info (click to toggle)
python-emmet-core 0.84.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 77,220 kB
  • sloc: python: 16,355; makefile: 30
file content (22 lines) | stat: -rw-r--r-- 704 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from datetime import datetime

import pytest
from pymatgen.core.structure import Structure

from . import test_structures

try:
    from emmet.core.optimade import OptimadeMaterialsDoc
except Exception:
    pytest.skip("could not import 'optimade' ", allow_module_level=True)


@pytest.mark.xfail(reason="Optimade + fastapi issues.")
@pytest.mark.parametrize("structure", test_structures.values())
def test_oxidation_state(structure: Structure):
    """Very simple test to make sure this actually works"""
    print(f"Should work : {structure.composition}")
    doc = OptimadeMaterialsDoc.from_structure(
        structure, material_id=33, last_updated=datetime.utcnow()
    )
    assert doc is not None