File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111from mp_api .client .core .settings import MAPIClientSettings
1212
1313if TYPE_CHECKING :
14- pass
14+ from typing import Any
1515
1616
1717def _compare_emmet_ver (
@@ -40,7 +40,9 @@ def _compare_emmet_ver(
4040 )(parse_version (ref_version ))
4141
4242
43- def load_json (json_like : str | bytes , deser : bool = False , encoding : str = "utf-8" ):
43+ def load_json (
44+ json_like : str | bytes , deser : bool = False , encoding : str = "utf-8"
45+ ) -> Any :
4446 """Utility to load json in consistent manner."""
4547 data = orjson .loads (
4648 json_like if isinstance (json_like , bytes ) else json_like .encode (encoding )
@@ -69,4 +71,4 @@ def validate_ids(id_list: list[str]) -> list[str]:
6971 # TODO: after the transition to AlphaID in the document models,
7072 # The following line should be changed to
7173 # return [validate_identifier(idx,serialize=True) for idx in id_list]
72- return [validate_identifier (idx ). string for idx in id_list ]
74+ return [str ( validate_identifier (idx )) for idx in id_list ]
Original file line number Diff line number Diff line change 33from packaging .version import parse as parse_version
44import pytest
55
6- from emmet .core .mpid import MPID , AlphaID
7-
86
97def test_emmet_core_version_checks (monkeypatch : pytest .MonkeyPatch ):
108 ref_ver = (1 , 2 , "3rc5" )
119 ref_ver_str = "." .join (str (x ) for x in ref_ver )
1210
13- import emmet . core
11+ import mp_api . client . core . utils
1412
15- monkeypatch .setattr (emmet . core , "__version__ " , ref_ver_str )
13+ monkeypatch .setattr (mp_api . client . core . utils , "_EMMET_CORE_VER " , ref_ver_str )
1614 from mp_api .client .core .utils import _compare_emmet_ver
1715
1816 assert _compare_emmet_ver (ref_ver_str , "==" )
@@ -27,6 +25,8 @@ def test_emmet_core_version_checks(monkeypatch: pytest.MonkeyPatch):
2725
2826
2927def test_id_validation ():
28+ from emmet .core .mpid import MPID , AlphaID
29+
3030 from mp_api .client .core .utils import validate_ids
3131 from mp_api .client .core .settings import MAPIClientSettings
3232
You can’t perform that action at this time.
0 commit comments