Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tst up coverage #5621

Merged
merged 4 commits into from Dec 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 24 additions & 1 deletion lib/matplotlib/tests/test_axes.py
Expand Up @@ -4112,7 +4112,6 @@ def test_violin_point_mass():
plt.violinplot(np.array([0, 0]))



@cleanup
def test_axisbg_warning():
fig = plt.figure()
Expand All @@ -4133,6 +4132,30 @@ def test_dash_offset():
plt.show()


@cleanup
def test_title_location_roundtrip():
fig, ax = plt.subplots()
ax.set_title('aardvark')
ax.set_title('left', loc='left')
ax.set_title('right', loc='right')

assert_equal('left', ax.get_title(loc='left'))
assert_equal('right', ax.get_title(loc='right'))
assert_equal('aardvark', ax.get_title())

assert_raises(ValueError, ax.get_title, loc='foo')
assert_raises(ValueError, ax.set_title, 'fail', loc='foo')


@image_comparison(baseline_images=["loglog"], remove_text=True,
extensions=['png'])
def test_loglog():
fig, ax = plt.subplots()
x = np.arange(1, 11)
ax.loglog(x, x**3, lw=5)
ax.tick_params(length=25, width=2)
ax.tick_params(length=15, width=2, which='minor')


if __name__ == '__main__':
import nose
Expand Down
39 changes: 34 additions & 5 deletions lib/matplotlib/tests/test_lines.py
Expand Up @@ -5,12 +5,13 @@
unicode_literals)

from matplotlib.externals import six

import itertools
import matplotlib.lines as mlines
import nose
from nose.tools import assert_true, assert_raises
from timeit import repeat
import numpy as np
import matplotlib as mpl

import matplotlib.pyplot as plt
from matplotlib.testing.decorators import cleanup, image_comparison
import sys
Expand Down Expand Up @@ -38,7 +39,7 @@ def test_invisible_Line_rendering():
ax = plt.subplot(111)

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

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

line = mpl.lines.Line2D([], [])
line = mlines.Line2D([], [])
with assert_raises(ValueError):
line.set_linestyle('aardvark')

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


@image_comparison(baseline_images=['marker_fill_styles'], remove_text=True,
extensions=['png'])
def test_marker_fill_styles():
colors = itertools.cycle(['b', 'g', 'r', 'c', 'm', 'y', 'k'])
altcolor = 'lightgreen'

y = np.array([1, 1])
x = np.array([0, 9])
fig, ax = plt.subplots()

for j, marker in enumerate(mlines.Line2D.filled_markers):
for i, fs in enumerate(mlines.Line2D.fillStyles):
color = next(colors)
ax.plot(j * 10 + x, y + i + .5 * (j % 2),
marker=marker,
markersize=20,
markerfacecoloralt=altcolor,
fillstyle=fs,
label=fs,
linewidth=5,
color=color,
markeredgecolor=color,
markeredgewidth=2)

ax.set_ylim([0, 7.5])
ax.set_xlim([-5, 135])


def test_nan_is_sorted():
# Exercises issue from PR #2744 (NaN throwing warning in _is_sorted)
line = mpl.lines.Line2D([],[])
line = mlines.Line2D([],[])
assert_true(line._is_sorted(np.array([1,2,3])))
assert_true(not line._is_sorted(np.array([1,np.nan,3])))

Expand Down