Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure uncertainties does not depend on numpy #2001

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -922,6 +922,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
Loading