From 0924bbd991aabb010bceb3a852835aab5402faa7 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Wed, 27 Mar 2024 14:05:09 +0100 Subject: [PATCH] Temporarily ignore the 2019 datasets Preparing for a 2014.x release, which will contain only the 2014 dataset. --- src/CoRE_MOF/load.py | 4 +- tests/test_datasets.py | 14 +++--- tests/test_properties.py | 16 +++---- tests/test_structures_1.py | 82 ++++++++++++++++---------------- tests/test_structures_3.py | 96 +++++++++++++++++++------------------- 5 files changed, 106 insertions(+), 106 deletions(-) diff --git a/src/CoRE_MOF/load.py b/src/CoRE_MOF/load.py index a155998..49c3ef4 100644 --- a/src/CoRE_MOF/load.py +++ b/src/CoRE_MOF/load.py @@ -11,8 +11,8 @@ # List of datasets available, and corresponding filenames __datasets = { "2014": "2014", - "2019-ASR": "2019-ASR", - "2019-FSR": "2019-FSR", + # "2019-ASR": "2019-ASR", + # "2019-FSR": "2019-FSR", } # Cache of the structures in each dataset diff --git a/tests/test_datasets.py b/tests/test_datasets.py index e46f2c1..7efe741 100644 --- a/tests/test_datasets.py +++ b/tests/test_datasets.py @@ -5,7 +5,7 @@ def test_datasets_1(): from CoRE_MOF import list_datasets x = list_datasets() assert isinstance(x, list) - assert len(x) == 3 + assert len(x) == 1 def test_datasets_2(): @@ -23,13 +23,13 @@ def test_datasets_3(): assert isinstance(x, list) assert len(x) == 4764 - x = CoRE_MOF.list_structures("2019-ASR") - assert isinstance(x, list) - assert len(x) == 12020 + # x = CoRE_MOF.list_structures("2019-ASR") + # assert isinstance(x, list) + # assert len(x) == 12020 - x = CoRE_MOF.list_structures("2019-FSR") - assert isinstance(x, list) - assert len(x) == 7061 + # x = CoRE_MOF.list_structures("2019-FSR") + # assert isinstance(x, list) + # assert len(x) == 7061 def test_datasets_4(): diff --git a/tests/test_properties.py b/tests/test_properties.py index 0eb6dbe..806ee31 100644 --- a/tests/test_properties.py +++ b/tests/test_properties.py @@ -11,11 +11,11 @@ def test_properties_1(): def test_properties_2(): import CoRE_MOF - p = CoRE_MOF.get_properties("2019-ASR") - assert p.shape == (12020, 42) - columns = p.columns.tolist() - assert "filename" in columns - assert "LCD" in columns - assert "ASA_m2_cm3" in columns - assert p["LCD"].min() < 3 - assert p["LCD"].max() > 30 + # p = CoRE_MOF.get_properties("2019-ASR") + # assert p.shape == (12020, 42) + # columns = p.columns.tolist() + # assert "filename" in columns + # assert "LCD" in columns + # assert "ASA_m2_cm3" in columns + # assert p["LCD"].min() < 3 + # assert p["LCD"].max() > 30 diff --git a/tests/test_structures_1.py b/tests/test_structures_1.py index 87971f2..750d044 100644 --- a/tests/test_structures_1.py +++ b/tests/test_structures_1.py @@ -2,44 +2,44 @@ import pytest -@pytest.mark.filterwarnings("ignore:.*rounded to ideal values") -def test_structures_1(): - import CoRE_MOF - from pymatgen.core import Structure - - x = CoRE_MOF.list_structures("2019-ASR") - assert "1499489-acs.cgd.6b01265_1499490_clean" in x - assert "ZUZZEB_clean" in x - - s = CoRE_MOF.get_structure("2019-ASR", "1499489-acs.cgd.6b01265_1499490_clean") - assert isinstance(s, Structure) - a, b, c = s.lattice.abc - assert math.isclose(a, 18.975) - assert math.isclose(b, 18.975) - assert math.isclose(c, 44.763) - alpha, beta, gamma = s.lattice.angles - assert math.isclose(alpha, 90) - assert math.isclose(beta, 90) - assert math.isclose(gamma, 120) - assert s.num_sites == 756 - - s = CoRE_MOF.get_structure("2019-ASR", "ZUZZEB_clean") - assert isinstance(s, Structure) - a, b, c = s.lattice.abc - assert math.isclose(a, 29.311) - assert math.isclose(b, 29.311) - assert math.isclose(c, 29.311) - alpha, beta, gamma = s.lattice.angles - assert math.isclose(alpha, 90) - assert math.isclose(beta, 90) - assert math.isclose(gamma, 90) - assert s.num_sites == 936 - - -def test_structures_2(): - import CoRE_MOF - - with pytest.raises(KeyError): - CoRE_MOF.get_structure("2019-ASR", "trucmuche") - with pytest.raises(KeyError): - CoRE_MOF.get_structure("2019-WTF", "ZUZZEB_clean") +# @pytest.mark.filterwarnings("ignore:.*rounded to ideal values") +# def test_structures_1(): +# import CoRE_MOF +# from pymatgen.core import Structure +# +# x = CoRE_MOF.list_structures("2019-ASR") +# assert "1499489-acs.cgd.6b01265_1499490_clean" in x +# assert "ZUZZEB_clean" in x +# +# s = CoRE_MOF.get_structure("2019-ASR", "1499489-acs.cgd.6b01265_1499490_clean") +# assert isinstance(s, Structure) +# a, b, c = s.lattice.abc +# assert math.isclose(a, 18.975) +# assert math.isclose(b, 18.975) +# assert math.isclose(c, 44.763) +# alpha, beta, gamma = s.lattice.angles +# assert math.isclose(alpha, 90) +# assert math.isclose(beta, 90) +# assert math.isclose(gamma, 120) +# assert s.num_sites == 756 +# +# s = CoRE_MOF.get_structure("2019-ASR", "ZUZZEB_clean") +# assert isinstance(s, Structure) +# a, b, c = s.lattice.abc +# assert math.isclose(a, 29.311) +# assert math.isclose(b, 29.311) +# assert math.isclose(c, 29.311) +# alpha, beta, gamma = s.lattice.angles +# assert math.isclose(alpha, 90) +# assert math.isclose(beta, 90) +# assert math.isclose(gamma, 90) +# assert s.num_sites == 936 +# +# +# def test_structures_2(): +# import CoRE_MOF +# +# with pytest.raises(KeyError): +# CoRE_MOF.get_structure("2019-ASR", "trucmuche") +# with pytest.raises(KeyError): +# CoRE_MOF.get_structure("2019-WTF", "ZUZZEB_clean") diff --git a/tests/test_structures_3.py b/tests/test_structures_3.py index c975a6a..fbc0d76 100644 --- a/tests/test_structures_3.py +++ b/tests/test_structures_3.py @@ -2,51 +2,51 @@ import pytest -def test_structures_1(): - import CoRE_MOF - - x = CoRE_MOF.list_structures("2019-ASR") - assert "1499489-acs.cgd.6b01265_1499490_clean" in x - assert "ZUZZEB_clean" in x - - s = CoRE_MOF.get_CIF_structure_data("2019-ASR", "1499489-acs.cgd.6b01265_1499490_clean") - assert isinstance(s, bytes) - string = s.decode('utf-8') - assert "_cell_length_a" in string - assert "_atom_site_fract_x" in string - - s = CoRE_MOF.get_CIF_structure_data("2019-ASR", "ZUZZEB_clean") - assert isinstance(s, bytes) - string = s.decode('utf-8') - assert "_cell_length_a" in string - assert "_atom_site_fract_x" in string - - -def test_structures_2(): - import CoRE_MOF - - with pytest.raises(KeyError): - CoRE_MOF.get_CIF_structure_data("2019-ASR", "trucmuche") - with pytest.raises(KeyError): - CoRE_MOF.get_CIF_structure_data("2019-WTF", "ZUZZEB_clean") - - -def test_structures_3(): - import CoRE_MOF - - x = CoRE_MOF.list_structures("2019-ASR") - assert "1499489-acs.cgd.6b01265_1499490_clean" in x - assert "ZUZZEB_clean" in x - - s = CoRE_MOF.get_CIF_structure_data("2019-ASR", "1499489-acs.cgd.6b01265_1499490_clean") - assert isinstance(s, bytes) - - with CoRE_MOF.get_CIF_structure_file("2019-ASR", "1499489-acs.cgd.6b01265_1499490_clean") as fname: - assert os.path.isfile(fname) - with open(fname, 'rb') as file: - # Content is the same as the other method - s2 = file.read() - assert s2 == s - - # Temporary file is automatically removed - assert not os.path.isfile(fname) +# def test_structures_1(): +# import CoRE_MOF +# +# x = CoRE_MOF.list_structures("2019-ASR") +# assert "1499489-acs.cgd.6b01265_1499490_clean" in x +# assert "ZUZZEB_clean" in x +# +# s = CoRE_MOF.get_CIF_structure_data("2019-ASR", "1499489-acs.cgd.6b01265_1499490_clean") +# assert isinstance(s, bytes) +# string = s.decode('utf-8') +# assert "_cell_length_a" in string +# assert "_atom_site_fract_x" in string +# +# s = CoRE_MOF.get_CIF_structure_data("2019-ASR", "ZUZZEB_clean") +# assert isinstance(s, bytes) +# string = s.decode('utf-8') +# assert "_cell_length_a" in string +# assert "_atom_site_fract_x" in string +# +# +# def test_structures_2(): +# import CoRE_MOF +# +# with pytest.raises(KeyError): +# CoRE_MOF.get_CIF_structure_data("2019-ASR", "trucmuche") +# with pytest.raises(KeyError): +# CoRE_MOF.get_CIF_structure_data("2019-WTF", "ZUZZEB_clean") +# +# +# def test_structures_3(): +# import CoRE_MOF +# +# x = CoRE_MOF.list_structures("2019-ASR") +# assert "1499489-acs.cgd.6b01265_1499490_clean" in x +# assert "ZUZZEB_clean" in x +# +# s = CoRE_MOF.get_CIF_structure_data("2019-ASR", "1499489-acs.cgd.6b01265_1499490_clean") +# assert isinstance(s, bytes) +# +# with CoRE_MOF.get_CIF_structure_file("2019-ASR", "1499489-acs.cgd.6b01265_1499490_clean") as fname: +# assert os.path.isfile(fname) +# with open(fname, 'rb') as file: +# # Content is the same as the other method +# s2 = file.read() +# assert s2 == s +# +# # Temporary file is automatically removed +# assert not os.path.isfile(fname)