Skip to content

Commit

Permalink
ensure uncertainties does not depend on numpy (#2001)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgbugs authored Jul 8, 2024
1 parent 74e2e6a commit 6483353
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pint/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ class BehaviorChangeWarning(UserWarning):

try:
from uncertainties import UFloat, ufloat
from uncertainties import unumpy as unp

unp = None

HAS_UNCERTAINTIES = True
except ImportError:
Expand All @@ -92,6 +93,8 @@ class BehaviorChangeWarning(UserWarning):
HAS_NUMPY = True
NUMPY_VER = np.__version__
if HAS_UNCERTAINTIES:
from uncertainties import unumpy as unp

NUMERIC_TYPES = (Number, Decimal, ndarray, np.number, UFloat)
else:
NUMERIC_TYPES = (Number, Decimal, ndarray, np.number)
Expand Down
1 change: 1 addition & 0 deletions pint/testsuite/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,7 @@ def test_issue_1400(self, sess_registry):
assert q2.format_babel("~", locale="es_ES") == "3,1 W/cm"
assert q2.format_babel("", locale="es_ES") == "3,1 vatios por centímetro"

@helpers.requires_numpy()
@helpers.requires_uncertainties()
def test_issue1611(self, module_registry):
from numpy.testing import assert_almost_equal
Expand Down

0 comments on commit 6483353

Please sign in to comment.