Skip to content

Commit

Permalink
Temporarily ignore the 2019 datasets
Browse files Browse the repository at this point in the history
Preparing for a 2014.x release, which will contain only the 2014 dataset.
  • Loading branch information
fxcoudert committed Mar 27, 2024
1 parent 7510d35 commit 0924bbd
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 106 deletions.
4 changes: 2 additions & 2 deletions src/CoRE_MOF/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions tests/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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():
Expand Down
16 changes: 8 additions & 8 deletions tests/test_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
82 changes: 41 additions & 41 deletions tests/test_structures_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
96 changes: 48 additions & 48 deletions tests/test_structures_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 0924bbd

Please sign in to comment.