Fix binary operations in NumPy 1.8

Also allow reconfigure travis to check this.

Close #73
This commit is contained in:
Hernan Grecco
2013-12-17 18:23:57 -03:00
parent 683f04c2d9
commit 13b74c997d
5 changed files with 10 additions and 10 deletions

View File

@@ -30,10 +30,3 @@ matrix:
env: NUMPY_VERSION=1.6
- python: "3.3"
env: NUMPY_VERSION=1.6
allow_failures:
- python: "2.7"
env: NUMPY_VERSION=1.8
- python: "3.2"
env: NUMPY_VERSION=1.8
- python: "3.3"
env: NUMPY_VERSION=1.8

View File

@@ -12,6 +12,8 @@ Pint Changelog
- Implemented default formatting for quantities.
- Changed comparison between Quantities containing NumPy arrays.
(Issue #75) - BACKWARDS INCOMPATIBLE CHANGE
- Fixes for NumPy 1.8 due to changes in handling binary ops.
(Issue #73)
0.3.3 (2013-11-29)
@@ -22,7 +24,9 @@ Pint Changelog
- Fix comparison of quantities.
(Issue #74)
- Fix Inequality operator.
(Issue #70)
(Issue #70, thanks muggenhor)
- Improved travis configuration.
(thanks muggenhor)
0.3.2 (2013-10-22)

View File

@@ -301,7 +301,8 @@ class _Quantity(object):
def __sub__(self, other):
return self.add_sub(other, operator.isub)
__rsub__ = __sub__
def __rsub__(self, other):
return -self.add_sub(other, operator.isub)
def __imul__(self, other):
if _check(self, other):

View File

@@ -11,9 +11,11 @@ try:
import numpy as np
HAS_NUMPY = True
ndarray = np.ndarray
NUMPY_VER = np.__version__
except ImportError:
np = None
HAS_NUMPY = False
NUMPY_VER = 0
class ndarray(object):
pass

View File

@@ -8,7 +8,7 @@ from pint import UnitRegistry
from pint.unit import UnitsContainer
from pint.util import ParserHelper
from pint.testsuite import HAS_NUMPY, np, TestCase, ndarray
from pint.testsuite import HAS_NUMPY, np, TestCase, ndarray, NUMPY_VER
class TestIssues(unittest.TestCase):