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

Skip to content

Commit 1c97376

Browse files
committed
Moved tests from cbook to tests_cbook
1 parent 282aeaf commit 1c97376

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

lib/matplotlib/cbook.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import numpy.ma as ma
2929

3030

31-
3231
import types
3332

3433

@@ -77,7 +76,7 @@ def unicode_safe(s):
7776
return unicode(s, preferredencoding)
7877

7978

80-
class converter:
79+
class converter(object):
8180
"""
8281
Base class for handling string -> python type with support for
8382
missing values
@@ -580,7 +579,8 @@ def get_sample_data(fname, asfileobj=True):
580579
if matplotlib.rcParams['examples.directory']:
581580
root = matplotlib.rcParams['examples.directory']
582581
else:
583-
root = os.path.join(os.path.dirname(__file__), "mpl-data", "sample_data")
582+
root = os.path.join(os.path.dirname(__file__),
583+
"mpl-data", "sample_data")
584584
path = os.path.join(root, fname)
585585

586586
if asfileobj:
@@ -830,7 +830,6 @@ def append(self, x):
830830
if len(self.data) == self.max:
831831
self.cur = 0
832832
# Permanently change self's class from non-full to full
833-
# FIXME __Full is not defined
834833
self.__class__ = __Full
835834

836835
def get(self):
@@ -1820,11 +1819,3 @@ def _check_output(*popenargs, **kwargs):
18201819
check_output = subprocess.check_output
18211820
else:
18221821
check_output = _check_output
1823-
1824-
1825-
if __name__ == '__main__':
1826-
assert(allequal([1, 1, 1]))
1827-
assert(not allequal([1, 1, 0]))
1828-
assert(allequal([]))
1829-
assert(allequal(('a', 'a')))
1830-
assert(not allequal(('a', 'b')))

lib/matplotlib/tests/test_cbook.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,9 @@ def test_rgba(self):
7878
assert_array_equal(actual[1], expected[1])
7979

8080

81+
def test_allequal():
82+
assert(cbook.allequal([1, 1, 1]))
83+
assert(not cbook.allequal([1, 1, 0]))
84+
assert(cbook.allequal([]))
85+
assert(cbook.allequal(('a', 'a')))
86+
assert(not cbook.allequal(('a', 'b')))

0 commit comments

Comments
 (0)