Skip to content

Commit 1948072

Browse files
committed
reverts 46c2efd, closes issue python-quantities#100
1 parent 59f5c8a commit 1948072

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

quantities/tests/test_uncertainty.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ def test_uncertaintity_nanmean(self):
7373
b = UncertainQuantity([1,2,np.nan], 'm', [.1,.2,np.nan])
7474
self.assertQuantityEqual(a.mean(),b.nanmean())
7575

76-
def test_uncertainquantity_subtract(self):
77-
a = UncertainQuantity(1, 'm', 1)
78-
b = a.copy() # different object
79-
self.assertQuantityEqual(a-a, UncertainQuantity(0, 'm', 0))
80-
self.assertQuantityEqual(a-b, UncertainQuantity(0, 'm', np.sqrt(2)))
81-
8276
def test_uncertainty_sqrt(self):
8377
a = UncertainQuantity([1,2], 'm', [.1,.2])
8478
self.assertQuantityEqual(a**0.5, a.sqrt())

quantities/uncertainquantity.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ def __radd__(self, other):
102102
@scale_other_units
103103
def __sub__(self, other):
104104
res = super(UncertainQuantity, self).__sub__(other)
105-
if self is not other:
106-
u = (self.uncertainty**2+other.uncertainty**2)**0.5
107-
else:
108-
u = self.uncertainty*0
105+
u = (self.uncertainty**2+other.uncertainty**2)**0.5
109106
return UncertainQuantity(res, uncertainty=u, copy=False)
110107

111108
@with_doc(Quantity.__rsub__, use_header=False)

0 commit comments

Comments
 (0)