Skip to content

Commit b698502

Browse files
committed
Merge pull request #5621 from tacaswell/tst_up_coverage
Tst up coverage
2 parents f2db477 + c3d386d commit b698502

File tree

4 files changed

+58
-6
lines changed

4 files changed

+58
-6
lines changed
Loading

lib/matplotlib/tests/test_axes.py

+24-1
Original file line numberDiff line numberDiff line change
@@ -4112,7 +4112,6 @@ def test_violin_point_mass():
41124112
plt.violinplot(np.array([0, 0]))
41134113

41144114

4115-
41164115
@cleanup
41174116
def test_axisbg_warning():
41184117
fig = plt.figure()
@@ -4133,6 +4132,30 @@ def test_dash_offset():
41334132
plt.show()
41344133

41354134

4135+
@cleanup
4136+
def test_title_location_roundtrip():
4137+
fig, ax = plt.subplots()
4138+
ax.set_title('aardvark')
4139+
ax.set_title('left', loc='left')
4140+
ax.set_title('right', loc='right')
4141+
4142+
assert_equal('left', ax.get_title(loc='left'))
4143+
assert_equal('right', ax.get_title(loc='right'))
4144+
assert_equal('aardvark', ax.get_title())
4145+
4146+
assert_raises(ValueError, ax.get_title, loc='foo')
4147+
assert_raises(ValueError, ax.set_title, 'fail', loc='foo')
4148+
4149+
4150+
@image_comparison(baseline_images=["loglog"], remove_text=True,
4151+
extensions=['png'])
4152+
def test_loglog():
4153+
fig, ax = plt.subplots()
4154+
x = np.arange(1, 11)
4155+
ax.loglog(x, x**3, lw=5)
4156+
ax.tick_params(length=25, width=2)
4157+
ax.tick_params(length=15, width=2, which='minor')
4158+
41364159

41374160
if __name__ == '__main__':
41384161
import nose

lib/matplotlib/tests/test_lines.py

+34-5
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
unicode_literals)
66

77
from matplotlib.externals import six
8-
8+
import itertools
9+
import matplotlib.lines as mlines
910
import nose
1011
from nose.tools import assert_true, assert_raises
1112
from timeit import repeat
1213
import numpy as np
13-
import matplotlib as mpl
14+
1415
import matplotlib.pyplot as plt
1516
from matplotlib.testing.decorators import cleanup, image_comparison
1617
import sys
@@ -38,7 +39,7 @@ def test_invisible_Line_rendering():
3839
ax = plt.subplot(111)
3940

4041
# Create a "big" Line instance:
41-
l = mpl.lines.Line2D(x,y)
42+
l = mlines.Line2D(x,y)
4243
l.set_visible(False)
4344
# but don't add it to the Axis instance `ax`
4445

@@ -112,7 +113,7 @@ def test_valid_linestyles():
112113
raise nose.SkipTest("assert_raises as context manager "
113114
"not supported with Python < 2.7")
114115

115-
line = mpl.lines.Line2D([], [])
116+
line = mlines.Line2D([], [])
116117
with assert_raises(ValueError):
117118
line.set_linestyle('aardvark')
118119

@@ -126,9 +127,37 @@ def test_set_line_coll_dash_image():
126127
cs = ax.contour(np.random.randn(20, 30), linestyles=[(0, (3, 3))])
127128

128129

130+
@image_comparison(baseline_images=['marker_fill_styles'], remove_text=True,
131+
extensions=['png'])
132+
def test_marker_fill_styles():
133+
colors = itertools.cycle(['b', 'g', 'r', 'c', 'm', 'y', 'k'])
134+
altcolor = 'lightgreen'
135+
136+
y = np.array([1, 1])
137+
x = np.array([0, 9])
138+
fig, ax = plt.subplots()
139+
140+
for j, marker in enumerate(mlines.Line2D.filled_markers):
141+
for i, fs in enumerate(mlines.Line2D.fillStyles):
142+
color = next(colors)
143+
ax.plot(j * 10 + x, y + i + .5 * (j % 2),
144+
marker=marker,
145+
markersize=20,
146+
markerfacecoloralt=altcolor,
147+
fillstyle=fs,
148+
label=fs,
149+
linewidth=5,
150+
color=color,
151+
markeredgecolor=color,
152+
markeredgewidth=2)
153+
154+
ax.set_ylim([0, 7.5])
155+
ax.set_xlim([-5, 135])
156+
157+
129158
def test_nan_is_sorted():
130159
# Exercises issue from PR #2744 (NaN throwing warning in _is_sorted)
131-
line = mpl.lines.Line2D([],[])
160+
line = mlines.Line2D([],[])
132161
assert_true(line._is_sorted(np.array([1,2,3])))
133162
assert_true(not line._is_sorted(np.array([1,np.nan,3])))
134163

0 commit comments

Comments
 (0)