Skip to content

Commit 7cede2d

Browse files
committed
PR changes
1 parent a812f20 commit 7cede2d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/citrine/informatics/predictors/chemical_formula_featurizer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,17 @@ def __init__(self,
157157
def powers(self) -> List[int]:
158158
"""The list of powers when computing generalized weighted means of element properties."""
159159
warn("The type of 'powers' will change to a list of floats in v4.0.0. To retrieve them as "
160-
"floats now, use 'powers_float'.")
160+
"floats now, use 'powers_as_float'.")
161161
return [int(p) for p in self._powers]
162162

163163
@powers.setter
164164
def powers(self, value: List[Union[int, float]]):
165165
self._powers = value
166166

167167
@property
168-
def powers_float(self) -> List[float]:
168+
def powers_as_float(self) -> List[float]:
169169
"""Powers when computing generalized weighted means of element properties."""
170-
warn("'powers_float' will be deprecated in v4.0.0 for 'powers', and removed in v5.0.0",
170+
warn("'powers_as_float' will be deprecated in v4.0.0 for 'powers', and removed in v5.0.0",
171171
PendingDeprecationWarning)
172172
return self._powers
173173

tests/informatics/test_predictors.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def test_chemical_featurizer(chemical_featurizer):
262262
with pytest.warns(UserWarning):
263263
assert chemical_featurizer.powers == [1, 2]
264264
with pytest.warns(PendingDeprecationWarning):
265-
assert chemical_featurizer.powers_float == [1.0, 2.0]
265+
assert chemical_featurizer.powers_as_float == [1.0, 2.0]
266266

267267
assert str(chemical_featurizer) == "<ChemicalFormulaFeaturizer 'Chemical featurizer'>"
268268

@@ -275,6 +275,12 @@ def test_chemical_featurizer(chemical_featurizer):
275275
'powers': [1, 2],
276276
'type': 'ChemicalFormulaFeaturizer'
277277
}
278+
279+
chemical_featurizer.powers = [0.5, -1.5]
280+
with pytest.warns(PendingDeprecationWarning):
281+
assert chemical_featurizer.powers_as_float == [0.5, -1.5]
282+
with pytest.warns(UserWarning):
283+
assert chemical_featurizer.powers == [0, -1]
278284

279285

280286
def test_auto_ml(auto_ml):

0 commit comments

Comments
 (0)