Skip to content

Commit 344a872

Browse files
committed
batch remove PymatgenTest inheritance and see what fail
1 parent 8bacdbc commit 344a872

File tree

134 files changed

+387
-423
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+387
-423
lines changed

tests/alchemy/test_filters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
from pymatgen.alchemy.transmuters import StandardTransmuter
1515
from pymatgen.analysis.structure_matcher import StructureMatcher
1616
from pymatgen.core import Lattice, Species, Structure
17-
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest
17+
from pymatgen.util.testing import TEST_FILES_DIR
1818

1919

20-
class TestContainsSpecieFilter(PymatgenTest):
20+
class TestContainsSpecieFilter:
2121
def test_filtering(self):
2222
coords = [[0, 0, 0], [0.75, 0.75, 0.75], [0.5, 0.5, 0.5], [0.25, 0.25, 0.25]]
2323
lattice = Lattice([[3.0, 0.0, 0.0], [1.0, 3.0, 0], [0, -2.0, 3.0]])
@@ -52,7 +52,7 @@ def test_as_from_dict(self):
5252
assert isinstance(ContainsSpecieFilter.from_dict(dct), ContainsSpecieFilter)
5353

5454

55-
class TestSpecieProximityFilter(PymatgenTest):
55+
class TestSpecieProximityFilter:
5656
def test_filter(self):
5757
struct = self.get_structure("Li10GeP2S12")
5858
sf = SpecieProximityFilter({"Li": 1})

tests/alchemy/test_materials.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
TEST_DIR = f"{TEST_FILES_DIR}/alchemy"
2222

2323

24-
class TestTransformedStructure(PymatgenTest):
24+
class TestTransformedStructure:
2525
def setUp(self):
2626
structure = PymatgenTest.get_structure("LiFePO4")
2727
self.structure = structure

tests/alchemy/test_transmuters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
RemoveSpeciesTransformation,
99
SubstitutionTransformation,
1010
)
11-
from pymatgen.util.testing import TEST_FILES_DIR, VASP_IN_DIR, PymatgenTest
11+
from pymatgen.util.testing import TEST_FILES_DIR, VASP_IN_DIR
1212

1313

14-
class TestCifTransmuter(PymatgenTest):
14+
class TestCifTransmuter:
1515
def test_init(self):
1616
trafos = [SubstitutionTransformation({"Fe": "Mn", "Fe2+": "Mn2+"})]
1717
tsc = CifTransmuter.from_filenames([f"{TEST_FILES_DIR}/cif/MultiStructure.cif"], trafos)
@@ -22,7 +22,7 @@ def test_init(self):
2222
assert expected == els
2323

2424

25-
class TestPoscarTransmuter(PymatgenTest):
25+
class TestPoscarTransmuter:
2626
def test_init(self):
2727
trafos = [SubstitutionTransformation({"Fe": "Mn"})]
2828
tsc = PoscarTransmuter.from_filenames([f"{VASP_IN_DIR}/POSCAR", f"{VASP_IN_DIR}/POSCAR"], trafos)

tests/analysis/chemenv/connectivity/test_connected_components.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
from pymatgen.core.lattice import Lattice
2121
from pymatgen.core.sites import PeriodicSite
2222
from pymatgen.core.structure import Structure
23-
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest
23+
from pymatgen.util.testing import TEST_FILES_DIR
2424

2525
__author__ = "waroquiers"
2626

2727

28-
class TestConnectedComponent(PymatgenTest):
28+
class TestConnectedComponent:
2929
def test_init(self):
3030
# Generic connected component not using EnvironmentNodes
3131
# (as_dict won't work on such a ConnectedComponent instance)

tests/analysis/chemenv/connectivity/test_environment_nodes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import json
44

55
from pymatgen.analysis.chemenv.connectivity.environment_nodes import EnvironmentNode
6-
from pymatgen.util.testing import PymatgenTest
76

87
try:
98
import bson
@@ -13,7 +12,7 @@
1312
__author__ = "waroquiers"
1413

1514

16-
class TestEnvironmentNodes(PymatgenTest):
15+
class TestEnvironmentNodes:
1716
def test_equal(self):
1817
struct = self.get_structure("SiO2")
1918
en = EnvironmentNode(central_site=struct[0], i_central_site=0, ce_symbol="T:4")

tests/analysis/chemenv/connectivity/test_structure_connectivity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
LightStructureEnvironments,
1010
StructureEnvironments,
1111
)
12-
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest
12+
from pymatgen.util.testing import TEST_FILES_DIR
1313

1414
__author__ = "waroquiers"
1515

1616

17-
class TestStructureConnectivity(PymatgenTest):
17+
class TestStructureConnectivity:
1818
def test_serialization(self):
1919
BaTiO3_se_fpath = f"{TEST_FILES_DIR}/analysis/chemenv/structure_environments/se_mp-5020.json"
2020
with open(BaTiO3_se_fpath) as file:

tests/analysis/chemenv/coordination_environments/test_chemenv_strategies.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010
DistanceCutoffFloat,
1111
SimplestChemenvStrategy,
1212
)
13-
from pymatgen.util.testing import PymatgenTest
1413

1514
__author__ = "waroquiers"
1615

1716

18-
class TestStrategyOptions(PymatgenTest):
17+
class TestStrategyOptions:
1918
def test_options(self):
2019
# DistanceCutoffFloat
2120
with pytest.raises(ValueError, match=r"Distance cutoff should be between 1 and \+infinity"):

tests/analysis/chemenv/coordination_environments/test_coordination_geometries.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
ExplicitPermutationsAlgorithm,
1212
SeparationPlane,
1313
)
14-
from pymatgen.util.testing import PymatgenTest
1514

1615
__author__ = "waroquiers"
1716

@@ -23,7 +22,7 @@ def __init__(self, coords):
2322
self.coords = coords
2423

2524

26-
class TestCoordinationGeometries(PymatgenTest):
25+
class TestCoordinationGeometries:
2726
def test_algorithms(self):
2827
expl_algo = ExplicitPermutationsAlgorithm(permutations=[[0, 1, 2], [1, 2, 3]])
2928
expl_algo2 = ExplicitPermutationsAlgorithm.from_dict(expl_algo.as_dict())

tests/analysis/chemenv/coordination_environments/test_coordination_geometry_finder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
symmetry_measure,
2020
)
2121
from pymatgen.core.structure import Lattice, Structure
22-
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest
22+
from pymatgen.util.testing import TEST_FILES_DIR
2323

2424
__author__ = "waroquiers"
2525

2626
json_dir = f"{TEST_FILES_DIR}/analysis/chemenv/json"
2727

2828

29-
class TestCoordinationGeometryFinder(PymatgenTest):
29+
class TestCoordinationGeometryFinder:
3030
def setUp(self):
3131
self.lgf = LocalGeometryFinder()
3232
self.lgf.setup_parameters(

tests/analysis/chemenv/coordination_environments/test_read_write.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
)
2323
from pymatgen.analysis.chemenv.coordination_environments.voronoi import DetailedVoronoiContainer
2424
from pymatgen.core.structure import Structure
25-
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest
25+
from pymatgen.util.testing import TEST_FILES_DIR
2626

2727
__author__ = "waroquiers"
2828

2929
json_dir = f"{TEST_FILES_DIR}/analysis/chemenv/json"
3030
struct_env_dir = f"{TEST_FILES_DIR}/analysis/chemenv/structure_environments"
3131

3232

33-
class TestReadWriteChemenv(PymatgenTest):
33+
class TestReadWriteChemenv:
3434
@classmethod
3535
def setUpClass(cls):
3636
cls.lgf = LocalGeometryFinder()

tests/analysis/chemenv/coordination_environments/test_structure_environments.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
StructureEnvironments,
1818
)
1919
from pymatgen.core import Species, Structure
20-
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest
20+
from pymatgen.util.testing import TEST_FILES_DIR
2121

2222
__author__ = "waroquiers"
2323

2424
TEST_DIR = f"{TEST_FILES_DIR}/analysis/chemenv/structure_environments"
2525

2626

27-
class TestStructureEnvironments(PymatgenTest):
27+
class TestStructureEnvironments:
2828
def test_structure_environments(self):
2929
with open(f"{TEST_DIR}/se_mp-7000.json") as file:
3030
dct = json.load(file)

tests/analysis/chemenv/coordination_environments/test_voronoi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
from pymatgen.analysis.chemenv.coordination_environments.voronoi import DetailedVoronoiContainer
66
from pymatgen.core.lattice import Lattice
77
from pymatgen.core.structure import Structure
8-
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest
8+
from pymatgen.util.testing import TEST_FILES_DIR
99

1010
__author__ = "waroquiers"
1111

1212
img_files_dir = f"{TEST_FILES_DIR}/analysis/chemenv/images"
1313

1414

15-
class TestVoronoiContainer(PymatgenTest):
15+
class TestVoronoiContainer:
1616
def test_voronoi(self):
1717
# Define a cubic lattice and a list of species (to be used for the fake structures)
1818
cubic_lattice = Lattice.cubic(10)

tests/analysis/chemenv/coordination_environments/test_weights.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
SelfCSMNbSetWeight,
1717
)
1818
from pymatgen.analysis.chemenv.coordination_environments.structure_environments import StructureEnvironments
19-
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest
19+
from pymatgen.util.testing import TEST_FILES_DIR
2020

2121
__author__ = "waroquiers"
2222

@@ -39,7 +39,7 @@ class DummyVoronoiContainer:
3939
pass
4040

4141

42-
class StrategyWeights(PymatgenTest):
42+
class StrategyWeights:
4343
def test_angle_weight(self):
4444
fake_nb_set = FakeNbSet()
4545
dummy_se = DummyStructureEnvironments()

tests/analysis/chemenv/utils/test_chemenv_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
from pymatgen.analysis.chemenv.utils.chemenv_config import ChemEnvConfig
44
from pymatgen.core import SETTINGS
5-
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest
5+
from pymatgen.util.testing import TEST_FILES_DIR
66

77
__author__ = "waroquiers"
88

99
config_file_dir = f"{TEST_FILES_DIR}/analysis/chemenv/config"
1010

1111

12-
class TestChemenvConfig(PymatgenTest):
12+
class TestChemenvConfig:
1313
def test_chemenv_config(self):
1414
config = ChemEnvConfig()
1515

tests/analysis/chemenv/utils/test_coordination_geometry_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77
from pytest import approx
88

99
from pymatgen.analysis.chemenv.utils.coordination_geometry_utils import Plane
10-
from pymatgen.util.testing import PymatgenTest
1110

1211
__author__ = "David Waroquiers"
1312

1413

15-
class TestPlanesUtils(PymatgenTest):
14+
class TestPlanesUtils:
1615
def setUp(self):
1716
# Test of plane 4x + 2y - 4z + 3 = 0 (used in most test cases)
1817
self.expected_coefficients = np.array([4, 2, -4, 3], float)

tests/analysis/chemenv/utils/test_graph_utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from pymatgen.analysis.chemenv.connectivity.environment_nodes import EnvironmentNode
77
from pymatgen.analysis.chemenv.utils.graph_utils import MultiGraphCycle, SimpleGraphCycle, get_delta
8-
from pymatgen.util.testing import PymatgenTest
98

109
__author__ = "waroquiers"
1110

@@ -68,7 +67,7 @@ def __lt__(self, other):
6867
return self.isite % 2 < other.isite % 2
6968

7069

71-
class TestGraphUtils(PymatgenTest):
70+
class TestGraphUtils:
7271
def test_get_delta(self):
7372
n1 = FakeNode(3)
7473
n2 = FakeNode(7)
@@ -664,7 +663,7 @@ def test_multigraph_cycle(self):
664663
assert mgc.edge_indices == edges_ref, f"Edges not equal for inodes = ({str_nodes})"
665664

666665

667-
class TestEnvironmentNodesGraphUtils(PymatgenTest):
666+
class TestEnvironmentNodesGraphUtils:
668667
def test_cycle(self):
669668
e1 = EnvironmentNode(central_site="Si", i_central_site=0, ce_symbol="T:4")
670669
e2 = EnvironmentNode(central_site="Si", i_central_site=3, ce_symbol="T:4")

tests/analysis/chemenv/utils/test_math_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
smootherstep,
1717
smoothstep,
1818
)
19-
from pymatgen.util.testing import PymatgenTest
2019

2120
__author__ = "waroquiers"
2221

2322

24-
class TestMathUtils(PymatgenTest):
23+
class TestMathUtils:
2524
def test_list_cartesian_product(self):
2625
list_of_lists = [[0, 1], [2, 5, 4], [5]]
2726
assert _cartesian_product(lists=list_of_lists) == [

tests/analysis/diffraction/test_neutron.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from pymatgen.analysis.diffraction.neutron import NDCalculator
77
from pymatgen.core.lattice import Lattice
88
from pymatgen.core.structure import Structure
9-
from pymatgen.util.testing import PymatgenTest
109

1110
"""
1211
These calculated values were verified with VESTA and FullProf.
@@ -20,7 +19,7 @@
2019
__date__ = "4/19/18"
2120

2221

23-
class TestNDCalculator(PymatgenTest):
22+
class TestNDCalculator:
2423
def test_get_pattern(self):
2524
struct = self.get_structure("CsCl")
2625
c = NDCalculator(wavelength=1.54184) # CuKa radiation

tests/analysis/diffraction/test_tem.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from pymatgen.analysis.diffraction.tem import TEMCalculator
1212
from pymatgen.core.lattice import Lattice
1313
from pymatgen.core.structure import Structure
14-
from pymatgen.util.testing import PymatgenTest
1514

1615
__author__ = "Frank Wan, Jason Liang"
1716
__copyright__ = "Copyright 2019, The Materials Project"
@@ -21,7 +20,7 @@
2120
__date__ = "2/20/20"
2221

2322

24-
class TestTEMCalculator(PymatgenTest):
23+
class TestTEMCalculator:
2524
def test_wavelength_rel(self):
2625
# Test that the relativistic wavelength formula (for 200 kV electron beam) is correct
2726
tem_calc = TEMCalculator()

tests/analysis/diffraction/test_xrd.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from pymatgen.analysis.diffraction.xrd import XRDCalculator
77
from pymatgen.core.lattice import Lattice
88
from pymatgen.core.structure import Structure
9-
from pymatgen.util.testing import PymatgenTest
109

1110
__author__ = "Shyue Ping Ong"
1211
__copyright__ = "Copyright 2012, The Materials Project"
@@ -16,7 +15,7 @@
1615
__date__ = "5/22/14"
1716

1817

19-
class TestXRDCalculator(PymatgenTest):
18+
class TestXRDCalculator:
2019
def test_type_wavelength(self):
2120
"""Test TypeError is raised if wavelength is unaccepted type."""
2221
wavelength = [1.78, 2.78] # just a list

tests/analysis/elasticity/test_elastic.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
from pymatgen.core.structure import Structure
2828
from pymatgen.core.tensors import Tensor
2929
from pymatgen.core.units import FloatWithUnit
30-
from pymatgen.util.testing import TEST_FILES_DIR, PymatgenTest
30+
from pymatgen.util.testing import TEST_FILES_DIR
3131

3232
TEST_DIR = f"{TEST_FILES_DIR}/analysis/elasticity"
3333

3434

35-
class TestElasticTensor(PymatgenTest):
35+
class TestElasticTensor:
3636
def setUp(self):
3737
self.voigt_1 = [
3838
[59.33, 28.08, 28.08, 0, 0, 0],
@@ -263,7 +263,7 @@ def test_energy_density(self):
263263
)
264264

265265

266-
class TestElasticTensorExpansion(PymatgenTest):
266+
class TestElasticTensorExpansion:
267267
def setUp(self):
268268
with open(f"{TEST_DIR}/test_toec_data.json") as file:
269269
self.data_dict = json.load(file)
@@ -364,7 +364,7 @@ def test_get_yield_stress(self):
364364
self.exp_cu_4.get_yield_stress([1, 0, 0])
365365

366366

367-
class TestNthOrderElasticTensor(PymatgenTest):
367+
class TestNthOrderElasticTensor:
368368
def setUp(self):
369369
with open(f"{TEST_DIR}/test_toec_data.json") as file:
370370
self.data_dict = json.load(file)
@@ -401,7 +401,7 @@ def test_energy_density(self):
401401
self.c3.energy_density(self.strains[0])
402402

403403

404-
class TestDiffFit(PymatgenTest):
404+
class TestDiffFit:
405405
"""Test various functions related to diff fitting."""
406406

407407
def setUp(self):

0 commit comments

Comments
 (0)