10000 Most tests starting with a are now PEP8 compliant. · matplotlib/matplotlib@e104a0e · GitHub
[go: up one dir, main page]

Skip to content

Commit e104a0e

Browse files
committed
Most tests starting with a are now PEP8 compliant.
1 parent a9fc091 commit e104a0e

File tree

6 files changed

+27
-30
lines changed

6 files changed

+27
-30
lines changed

lib/matplotlib/tests/test_agg.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
from __future__ import print_function
2-
32
import os
43
import tempfile
54

6-
75
from numpy.testing import assert_array_almost_equal
86

9-
107
from matplotlib.image import imread
118
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
129
from matplotlib.figure import Figure
@@ -102,7 +99,8 @@ def report_memory(i):
10299
## avgMem = (end - start) / float(N)
103100
## print 'Average memory consumed per loop: %1.4f\n' % (avgMem)
104101

105-
## #TODO: Verify the expected mem usage and approximate tolerance that should be used
102+
## #TODO: Verify the expected mem usage and approximate tolerance that
103+
## # should be used
106104
## #self.checkClose( 0.32, avgMem, absTol = 0.1 )
107105

108106
## # w/o text and w/o write_png: Average memory consumed per loop: 0.02

lib/matplotlib/tests/test_animation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
from __future__ import print_function
12
import os
23
import tempfile
4+
35
import numpy as np
6+
47
from matplotlib import pyplot as plt
58
from matplotlib import animation
69
from matplotlib.testing.noseclasses import KnownFailureTest
@@ -13,7 +16,6 @@
1316
imagemagick='gif', imagemagick_file='gif')
1417

1518

16-
1719
# Smoke test for saving animations. In the future, we should probably
1820
# design more sophisticated tests which compare resulting frames a-la
1921
# matplotlib.testing.image_comparison
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1+
from __future__ import print_function
2+
13
import matplotlib.pyplot as plt
24
from matplotlib.testing.decorators import image_comparison
35
import matplotlib
46

7+
58
def draw_arrow(ax, t, r):
6-
ax.annotate('', xy=(0.5, 0.5+r), xytext=(0.5, 0.5), size=30,
9+
ax.annotate('', xy=(0.5, 0.5 + r), xytext=(0.5, 0.5), size=30,
710
arrowprops=dict(arrowstyle=t,
811
fc="b", ec='k'))
912

13+
1014
@image_comparison(baseline_images=['fancyarrow_test_image'])
1115
def test_fancyarrow():
1216
r = [0.4, 0.3, 0.2, 0.1]
1317
t = ["fancy", "simple", matplotlib.patches.ArrowStyle.Fancy()]
1418

1519
fig, axes = plt.subplots(len(t), len(r), squeeze=False,
1620
subplot_kw=dict(aspect=True),
17-
figsize=(8, 4.5))
21+
figsize=(8, 4.5))
1822

1923
for i_r, r1 in enumerate(r):
2024
for i_t, t1 in enumerate(t):
@@ -23,7 +27,6 @@ def test_fancyarrow():
2327
ax.tick_params(labelleft=False, labelbottom=False)
2428

2529

26-
if __name__=='__main__':
30+
if __name__ == '__main__':
2731
import nose
28-
nose.runmodule(argv=['-s','--with-doctest'], exit=False)
29-
32+
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

lib/matplotlib/tests/test_artist.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
from __future__ import print_function
22

3-
import copy
4-
5-
63
import numpy as np
74

8-
95
import matplotlib. 57AE pyplot as plt
106
import matplotlib.patches as mpatches
117
import matplotlib.path as mpath
@@ -93,16 +89,6 @@ def test_collection_transform_of_none():
9389
assert isinstance(c._transOffset, mtrans.IdentityTransform)
9490

9591

96-
def test_point_in_path():
97-
# Test #1787
98-
verts2 = [(0,0), (0,1), (1,1), (1,0), (0,0)]
99-
100-
path = mpath.Path(verts2, closed=True)
101-
points = [(0.5,0.5), (1.5,0.5)]
102-
103-
assert np.all(path.contains_points(points) == [True, False])
104-
105-
10692
@image_comparison(baseline_images=["clip_path_clipping"], remove_text=True)
10793
def test_clipping():
10894
exterior = mpath.Path.unit_rectangle().deepcopy()
@@ -134,6 +120,6 @@ def test_clipping():
134120
ax1.set_ylim([-3, 3])
135121

136122

137-
if __name__=='__main__':
123+
if __name__ == '__main__':
138124
import nose
139-
nose.runmodule(argv=['-s','--with-doctest'], exit=False)
125+
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

lib/matplotlib/tests/test_coding_standards.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ class StandardReportWithExclusions(pep8.StandardReport):
6262
'*/matplotlib/tri/tripcolor.py',
6363
'*/matplotlib/tri/triplot.py',
6464
'*/matplotlib/tests/__init__.py',
65-
'*/matplotlib/tests/test_agg.py',
66-
'*/matplotlib/tests/test_animation.py',
67-
'*/matplotlib/tests/test_arrow_patches.py',
68-
'*/matplotlib/tests/test_artist.py',
6965
'*/matplotlib/tests/test_axes.py',
7066
'*/matplotlib/tests/test_backend_pdf.py',
7167
'*/matplotlib/tests/test_backend_pgf.py',

lib/matplotlib/tests/test_path.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import numpy as np
2+
13
from matplotlib.path import Path
24
from nose.tools import assert_raises
35

@@ -11,6 +13,16 @@ def modify_vertices():
1113
assert_raises(AttributeError, modify_vertices)
1214

1315

16+
def test_point_in_path():
17+
# Test #1787
18+
verts2 = [(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]
19+
20+
path = Path(verts2, closed=True)
21+
points = [(0.5, 0.5), (1.5, 0.5)]
22+
23+
assert np.all(path.contains_points(points) == [True, False])
24+
25+
1426
if __name__ == '__main__':
1527
import nose
1628
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)
0