Skip to content

Commit 3744b4a

Browse files
authored
remove deprecated units (#4291)
1 parent a6793b5 commit 3744b4a

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

src/pymatgen/core/units.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
import collections
1414
import re
15-
import warnings
1615
from collections import defaultdict
1716
from functools import partial
1817
from numbers import Number
@@ -310,25 +309,6 @@ def __init__(
310309
unit (str | Unit): A unit. e.g. "C".
311310
unit_type (str): A type of unit. e.g. "charge"
312311
"""
313-
# Check deprecated memory unit
314-
# TODO: remove after 2025-01-01
315-
if unit_type == "memory" and str(unit) in {
316-
"Kb",
317-
"kb",
318-
"Mb",
319-
"mb",
320-
"Gb",
321-
"gb",
322-
"Tb",
323-
"tb",
324-
}:
325-
warnings.warn(
326-
f"Unit {unit!s} is deprecated, please use {str(unit).upper()} instead",
327-
DeprecationWarning,
328-
stacklevel=2,
329-
)
330-
unit = str(unit).upper()
331-
332312
if unit_type is not None and str(unit) not in ALL_UNITS[unit_type]:
333313
raise UnitError(f"{unit} is not a supported unit for {unit_type}")
334314

tests/core/test_units.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
import warnings
4-
53
import pytest
64
from numpy.testing import assert_array_equal
75
from pytest import approx
@@ -109,17 +107,6 @@ def test_memory(self):
109107
mega_3 = Memory.from_str("+1.0 MB")
110108
assert mega_0 == mega_1 == mega_2 == mega_3
111109

112-
def test_deprecated_memory(self):
113-
# TODO: remove after 2025-01-01
114-
for unit in ("Kb", "kb", "Mb", "mb", "Gb", "gb", "Tb", "tb"):
115-
with pytest.warns(DeprecationWarning, match=f"Unit {unit} is deprecated"):
116-
Memory(1, unit)
117-
118-
with warnings.catch_warnings():
119-
warnings.simplefilter("error")
120-
for unit in ("KB", "MB", "GB", "TB"):
121-
Memory(1, unit)
122-
123110
def test_unitized(self):
124111
@unitized("eV")
125112
def func1():

0 commit comments

Comments
 (0)