Skip to content

Commit 729a5df

Browse files
committed
snake_case assertMSONable to assert_msonable
1 parent 91013e1 commit 729a5df

File tree

8 files changed

+24
-24
lines changed

8 files changed

+24
-24
lines changed

pymatgen/core/tests/test_libxcfunc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ def test_libxcfunc_api(self):
2424
self.serialize_with_pickle(xc, test_eq=True)
2525

2626
# Test if object supports MSONable
27-
self.assertMSONable(xc, test_if_subclass=False)
27+
self.assert_msonable(xc, test_if_subclass=False)

pymatgen/core/tests/test_structure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,7 @@ def test_to_from_dict(self):
17051705
d = self.mol.as_dict()
17061706
mol2 = Molecule.from_dict(d)
17071707
assert isinstance(mol2, Molecule)
1708-
self.assertMSONable(self.mol)
1708+
self.assert_msonable(self.mol)
17091709

17101710
def test_apply_operation(self):
17111711
op = SymmOp.from_axis_angle_and_translation([0, 0, 1], 90)

pymatgen/io/abinit/tests/test_abiobjects.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ def test_base(self):
125125
self.serialize_with_pickle(polarized)
126126

127127
# Test dict methods
128-
self.assertMSONable(polarized)
129-
self.assertMSONable(unpolarized)
128+
self.assert_msonable(polarized)
129+
self.assert_msonable(unpolarized)
130130

131131

132132
class SmearingTest(PymatgenTest):
@@ -145,7 +145,7 @@ def test_base(self):
145145

146146
assert not nosmear
147147
assert nosmear != fd1ev
148-
self.assertMSONable(nosmear)
148+
self.assert_msonable(nosmear)
149149

150150
new_fd1ev = Smearing.from_dict(fd1ev.as_dict())
151151
assert new_fd1ev == fd1ev
@@ -154,7 +154,7 @@ def test_base(self):
154154
self.serialize_with_pickle(fd1ev)
155155

156156
# Test dict methods
157-
self.assertMSONable(fd1ev)
157+
self.assert_msonable(fd1ev)
158158

159159

160160
class ElectronsAlgorithmTest(PymatgenTest):
@@ -166,7 +166,7 @@ def test_base(self):
166166
self.serialize_with_pickle(algo)
167167

168168
# Test dict methods
169-
self.assertMSONable(algo)
169+
self.assert_msonable(algo)
170170

171171

172172
class ElectronsTest(PymatgenTest):
@@ -193,7 +193,7 @@ def test_base(self):
193193
)
194194

195195
# Test dict methods
196-
self.assertMSONable(custom_electrons)
196+
self.assert_msonable(custom_electrons)
197197

198198

199199
class KSamplingTest(PymatgenTest):
@@ -204,8 +204,8 @@ def test_base(self):
204204
monkhorst.to_abivars()
205205

206206
# Test dict methods
207-
self.assertMSONable(monkhorst)
208-
self.assertMSONable(gamma_centered)
207+
self.assert_msonable(monkhorst)
208+
self.assert_msonable(gamma_centered)
209209

210210

211211
class RelaxationTest(PymatgenTest):
@@ -216,8 +216,8 @@ def test_base(self):
216216
atoms_and_cell.to_abivars()
217217

218218
# Test dict methods
219-
self.assertMSONable(atoms_and_cell)
220-
self.assertMSONable(atoms_only)
219+
self.assert_msonable(atoms_and_cell)
220+
self.assert_msonable(atoms_only)
221221

222222

223223
class PPModelTest(PymatgenTest):
@@ -242,4 +242,4 @@ def test_base(self):
242242
self.serialize_with_pickle(godby)
243243

244244
# Test dict methods
245-
self.assertMSONable(godby)
245+
self.assert_msonable(godby)

pymatgen/io/abinit/tests/test_pseudos.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_nc_pseudos(self):
5858
self.serialize_with_pickle(pseudo, test_eq=False)
5959

6060
# Test MSONable
61-
self.assertMSONable(pseudo)
61+
self.assert_msonable(pseudo)
6262

6363
# HGH pseudos
6464
pseudo = self.Si_hgh
@@ -119,7 +119,7 @@ def test_pawxml_pseudos(self):
119119
# Test pickle
120120
new_objs = self.serialize_with_pickle(oxygen, test_eq=False)
121121
# Test MSONable
122-
self.assertMSONable(oxygen)
122+
self.assert_msonable(oxygen)
123123

124124
for o in new_objs:
125125
assert o.ispaw
@@ -150,7 +150,7 @@ def test_oncvpsp_pseudo_sr(self):
150150

151151
# Data persistence
152152
self.serialize_with_pickle(ger, test_eq=False)
153-
self.assertMSONable(ger)
153+
self.assert_msonable(ger)
154154

155155
def test_oncvpsp_pseudo_fr(self):
156156
"""
@@ -162,7 +162,7 @@ def test_oncvpsp_pseudo_fr(self):
162162

163163
# Data persistence
164164
self.serialize_with_pickle(pb, test_eq=False)
165-
self.assertMSONable(pb)
165+
self.assert_msonable(pb)
166166

167167
assert pb.symbol == "Pb"
168168
assert pb.Z == 82.0
@@ -191,7 +191,7 @@ def test_methods(self):
191191

192192
d = table.as_dict()
193193
PseudoTable.from_dict(d)
194-
self.assertMSONable(table)
194+
self.assert_msonable(table)
195195

196196
selected = table.select_symbols("Si")
197197
assert len(selected) == len(table)

pymatgen/io/cp2k/tests/test_inputs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def test_basic_sections(self):
162162
ci = Cp2kInput.from_string(s)
163163
assert ci["GLOBAL"]["RUN_TYPE"] == Keyword("RUN_TYPE", "energy")
164164
assert ci["GLOBAL"]["PROJECT_NAME"].description == "default name"
165-
self.assertMSONable(ci)
165+
self.assert_msonable(ci)
166166

167167
def test_sectionlist(self):
168168
s1 = Section("TEST")

pymatgen/phonon/tests/test_bandstructure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ def test_dict_methods(self):
7979
s = self.bs2.as_phononwebsite()
8080
assert s is not None
8181
assert json.dumps(s) is not None
82-
self.assertMSONable(self.bs)
83-
self.assertMSONable(self.bs2)
82+
self.assert_msonable(self.bs)
83+
self.assert_msonable(self.bs2)
8484

8585
def test_write_methods(self):
8686
self.bs2.write_phononwebsite("test.json")

pymatgen/phonon/tests/test_dos.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_get_smeared_densities(self):
3434
def test_dict_methods(self):
3535
s = json.dumps(self.dos.as_dict())
3636
assert s is not None
37-
self.assertMSONable(self.dos)
37+
self.assert_msonable(self.dos)
3838

3939
def test_thermodynamic_functions(self):
4040
assert self.dos.cv(300, structure=self.structure) == approx(48.049366665412485, abs=1e-4)
@@ -68,7 +68,7 @@ def test_properties(self):
6868
def test_dict_methods(self):
6969
s = json.dumps(self.cdos.as_dict())
7070
assert s is not None
71-
self.assertMSONable(self.cdos)
71+
self.assert_msonable(self.cdos)
7272

7373
def test_str(self):
7474
assert str(self.cdos) is not None

pymatgen/util/testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def serialize_with_pickle(self, objects, protocols=None, test_eq=True):
150150
return [o[0] for o in objects_by_protocol]
151151
return objects_by_protocol
152152

153-
def assertMSONable(self, obj, test_if_subclass=True):
153+
def assert_msonable(self, obj, test_if_subclass=True):
154154
"""
155155
Test if obj is MSONable and verify the contract is fulfilled.
156156

0 commit comments

Comments
 (0)