FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Test reorg by mdboom · Pull Request #74 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .pdf  (7) .png  (6) .py  (19) .svg  (6) All 4 file types selected
Deleted files Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
3 changes: 3 additions & 0 deletions lib/matplotlib/pylab.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,6 @@ def save(*args, **kwargs):

# don't let numpy's datetime hide stdlib
import datetime

if sys.version_info > (2, 6, 0):
bytes = __builtins__['bytes']
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
609 changes: 609 additions & 0 deletions lib/matplotlib/tests/baseline_images/test_axes/markevery.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
1,071 changes: 1,071 additions & 0 deletions lib/matplotlib/tests/baseline_images/test_legend/legend_auto2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
78 changes: 78 additions & 0 deletions lib/matplotlib/tests/test_axes.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,84 @@ def test_canonical():
ax.plot([1,2,3])
fig.savefig('canonical')


@image_comparison(baseline_images=['arc_ellipse'])
def test_arc_ellipse():
from matplotlib import patches
xcenter, ycenter = 0.38, 0.52
width, height = 1e-1, 3e-1
angle = -30

theta = np.arange(0.0, 360.0, 1.0)*np.pi/180.0
x = width/2. * np.cos(theta)
y = height/2. * np.sin(theta)

rtheta = angle*np.pi/180.
R = np.array([
[np.cos(rtheta), -np.sin(rtheta)],
[np.sin(rtheta), np.cos(rtheta)],
])

x, y = np.dot(R, np.array([x, y]))
x += xcenter
y += ycenter

fig = plt.figure()
ax = fig.add_subplot(211, aspect='auto')
ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1)

e1 = patches.Arc((xcenter, ycenter), width, height,
angle=angle, linewidth=2, fill=False, zorder=2)

ax.add_patch(e1)

ax = fig.add_subplot(212, aspect='equal')
ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1)
e2 = patches.Arc((xcenter, ycenter), width, height,
angle=angle, linewidth=2, fill=False, zorder=2)

ax.add_patch(e2)

fig.savefig('arc_ellipse')

@image_comparison(baseline_images=['units_strings'])
def test_units_strings():
# Make sure passing in sequences of strings doesn't cause the unit
# conversion registry to recurse infinitely
Id = ['50', '100', '150', '200', '250']
pout = ['0', '7.4', '11.4', '14.2', '16.3']
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(Id, pout)
fig.savefig('units_strings')

@image_comparison(baseline_images=['markevery'])
def test_markevery():
x, y = np.random.rand(2, 100)

# check marker only plot
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x, y, 'o', label='default')
ax.plot(x, y, 'd', markevery=None, label='mark all')
ax.plot(x, y, 's', markevery=10, label='mark every 10')
ax.plot(x, y, '+', markevery=(5, 20), label='mark every 5 starting at 10')
ax.legend()
fig.savefig('markevery')

@image_comparison(baseline_images=['markevery_line'])
def test_markevery_line():
x, y = np.random.rand(2, 100)
# check line/marker combos
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x, y, '-o', label='default')
ax.plot(x, y, '-d', markevery=None, label='mark all')
ax.plot(x, y, '-s', markevery=10, label='mark every 10')
ax.plot(x, y, '-+', markevery=(5, 20), label='mark every 5 starting at 10')
ax.legend()
fig.savefig('markevery_line')

if __name__=='__main__':
import nose
nose.runmodule(argv=['-s','--with-doctest'], exit=False)
25 changes: 25 additions & 0 deletions lib/matplotlib/tests/test_backend_pdf.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- encoding: utf-8 -*-

from matplotlib import rcParams
from matplotlib import pyplot as plt
from matplotlib.testing.decorators import image_comparison, knownfailureif

@image_comparison(baseline_images=['pdf_use14corefonts'], extensions=['pdf'])
def test_use14corefonts():
rcParams['backend'] = 'pdf'
rcParams['pdf.use14corefonts'] = True
rcParams['font.family'] = 'sans-serif'
rcParams['font.size'] = 8
rcParams['font.sans-serif'] = ['Helvetica']

title = u'Test PDF backend with option use14corefonts=True'

text = u'''A three-line text positioned just above a blue line
and containing some French characters and the euro symbol:
"Merci pépé pour les 10 €"'''

plt.figure()
plt.title(title)
plt.text(0.5, 0.5, text, horizontalalignment='center', fontsize=24)
plt.axhline(0.5, linewidth=0.5)
plt.savefig('pdf_use14corefonts.pdf')
22 changes: 22 additions & 0 deletions lib/matplotlib/tests/test_basic.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
from nose.tools import assert_equal
from matplotlib.testing.decorators import knownfailureif
import sys

def test_simple():
assert_equal(1+1,2)

@knownfailureif(True)
def test_simple_knownfail():
assert_equal(1+1,3)

from pylab import *
def test_override_builtins():
ok_to_override = set([
'__name__',
'__doc__',
'__package__',
'any',
'all',
'sum'
])

overridden = False
for key in globals().keys():
if key in dir(sys.modules["__builtin__"]):
if (globals()[key] != getattr(sys.modules["__builtin__"], key) and
key not in ok_to_override):
print "'%s' was overridden in globals()." % key
overridden = True

assert not overridden
52 changes: 51 additions & 1 deletion lib/matplotlib/tests/test_cbook.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import numpy as np
from numpy.testing.utils import assert_array_equal
import matplotlib.cbook as cbook
from nose.tools import assert_equal
import matplotlib.colors as mcolors
from nose.tools import assert_equal, raises
from datetime import datetime

def test_is_string_like():
y = np.arange( 10 )
Expand All @@ -27,3 +30,50 @@ def test_restrict_dict():
assert_equal(d5, {'foo': 'bar'})
# check that d was not modified
assert_equal(d, {'foo': 'bar', 1: 2})

from matplotlib.cbook import delete_masked_points as dmp

class Test_delete_masked_points():
def setUp(self):
self.mask1 = [False, False, True, True, False, False]
self.arr0 = np.arange(1.0,7.0)
self.arr1 = [1,2,3,np.nan,np.nan,6]
self.arr2 = np.array(self.arr1)
self.arr3 = np.ma.array(self.arr2, mask=self.mask1)
self.arr_s = ['a', 'b', 'c', 'd', 'e', 'f']
self.arr_s2 = np.array(self.arr_s)
self.arr_dt = [datetime(2008, 1, 1), datetime(2008, 1, 2),
datetime(2008, 1, 3), datetime(2008, 1, 4),
datetime(2008, 1, 5), datetime(2008, 1, 6)]
self.arr_dt2 = np.array(self.arr_dt)
self.arr_colors = ['r', 'g', 'b', 'c', 'm', 'y']
self.arr_rgba = mcolors.colorConverter.to_rgba_array(self.arr_colors)

@raises(ValueError)
def test_bad_first_arg(self):
dmp('a string', self.arr0)

def test_string_seq(self):
actual = dmp(self.arr_s, self.arr1)
ind = [0, 1, 2, 5]
expected = (self.arr_s2.take(ind), self.arr2.take(ind))
assert_array_equal(actual[0], expected[0])
assert_array_equal(actual[1], expected[1])

def test_datetime(self):
actual = dmp(self.arr_dt, self.arr3)
ind = [0, 1, 5]
expected = (self.arr_dt2.take(ind),
self.arr3.take(ind).compressed())
assert_array_equal(actual[0], expected[0])
assert_array_equal(actual[1], expected[1])

def test_rgba(self):
actual = dmp(self.arr3, self.arr_rgba)
ind = [0, 1, 5]
expected = (self.arr3.take(ind).compressed(),
self.arr_rgba.take(ind, axis=0))
assert_array_equal(actual[0], expected[0])
assert_array_equal(actual[1], expected[1])


29 changes: 29 additions & 0 deletions lib/matplotlib/tests/test_legend.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import numpy as np

from matplotlib.testing.decorators import image_comparison, knownfailureif
import matplotlib.pyplot as plt
from nose.tools import assert_raises
from numpy.testing import assert_array_equal

@image_comparison(baseline_images=['legend_auto1'])
def test_legend_auto1():
'Test automatic legend placement'
fig = plt.figure()
ax = fig.add_subplot(111)
x = np.arange(100)
ax.plot(x, 50-x, 'o', label='y=1')
ax.plot(x, x-50, 'o', label='y=-1')
ax.legend(loc=0)
fig.savefig('legend_auto1')

@image_comparison(baseline_images=['legend_auto2'])
def test_legend_auto2():
'Test automatic legend placement'
fig = plt.figure()
ax = fig.add_subplot(111)
x = np.arange(100)
b1 = ax.bar(x, x, color='m')
b2 = ax.bar(x, x[::-1], color='g')
ax.legend([b1[0], b2[0]], ['up', 'down'], loc=0)
fig.savefig('legend_auto2')

82 changes: 0 additions & 82 deletions unit/auto_legend.py

This file was deleted.

52 changes: 0 additions & 52 deletions unit/cbook_unit.py

This file was deleted.

Loading

Back | FazBrowse Home | New Git URL