Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed7d353

Browse files
tacaswellQuLogic
authored andcommitted
FIX: implement __ne__ for SubplotSpec
In python3 `__ne__` automatically delegates to `__eq__`, in python2 it does not and falls back to the default `__ne__` test. The NumPy version of `assert_equal` actually checks `if a != b: raise`, whereas the version of `assert_equal` from `unittest` (where `nose` ultimately pulls from) checks `if not a == b: raise`
1 parent c520c2c commit ed7d353

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/gridspec.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,6 @@ def get_position(self, fig, return_all=False):
453453
else:
454454
return figbox
455455

456-
457456
def get_topmost_subplotspec(self):
458457
'get the topmost SubplotSpec instance associated with the subplot'
459458
gridspec = self.get_gridspec()
@@ -473,6 +472,10 @@ def __eq__(self, other):
473472
self.num1 == other.num1,
474473
self.num2 == other.num2))
475474

475+
if six.PY2:
476+
def __ne__(self, other):
477+
return not self == other
478+
476479
def __hash__(self):
477480
return (hash(self._gridspec) ^
478481
hash(self.num1) ^

0 commit comments

Comments
 (0)