Skip to content
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
4 changes: 2 additions & 2 deletions quantities/quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,8 @@ def clip(self, min=None, max=None, out=None):
if min is None and max is None:
raise ValueError("at least one of min or max must be set")
else:
if min is None: min = Quantity(-np.Inf, self._dimensionality)
if max is None: max = Quantity(np.Inf, self._dimensionality)
if min is None: min = Quantity(-np.inf, self._dimensionality)
if max is None: max = Quantity(np.inf, self._dimensionality)

if self.dimensionality and not \
(isinstance(min, Quantity) and isinstance(max, Quantity)):
Expand Down
10 changes: 5 additions & 5 deletions quantities/tests/test_umath.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_sum(self):
self.assertQuantityEqual(np.sum(self.q), 10 * pq.J)

def test_nansum(self):
c = [1,2,3, np.NaN] * pq.m
c = [1,2,3, np.nan] * pq.m
self.assertQuantityEqual(np.nansum(c), 6 * pq.m)

def test_cumprod(self):
Expand Down Expand Up @@ -114,19 +114,19 @@ def test_around(self):
[0, 0, 0, 10] * pq.J
)

def test_round_(self):
def test_round(self):
self.assertQuantityEqual(
np.round_([.5, 1.5, 2.5, 3.5, 4.5] * pq.J),
np.round([.5, 1.5, 2.5, 3.5, 4.5] * pq.J),
[0., 2., 2., 4., 4.] * pq.J
)

self.assertQuantityEqual(
np.round_([1,2,3,11] * pq.J, decimals=1),
np.round([1,2,3,11] * pq.J, decimals=1),
[1, 2, 3, 11] * pq.J
)

self.assertQuantityEqual(
np.round_([1,2,3,11] * pq.J, decimals=-1),
np.round([1,2,3,11] * pq.J, decimals=-1),
[0, 0, 0, 10] * pq.J
)

Expand Down