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

Skip to content

Commit d8a9e85

Browse files
committed
testing: add new, simplified testing infrastructure
svn path=/trunk/matplotlib/; revision=7647
1 parent 88e74bb commit d8a9e85

5 files changed

Lines changed: 55 additions & 0 deletions

File tree

lib/matplotlib/tests/__init__.py

Whitespace-only changes.

lib/matplotlib/tests/test_basic.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from nose.tools import assert_equal
2+
from matplotlib.testing.decorators import knownfailureif
3+
4+
def test_simple():
5+
'''very simple example test'''
6+
assert_equal(1+1,2)
7+
8+
@knownfailureif(True)
9+
def test_simple_fail():
10+
'''very simple example test that should fail'''
11+
assert_equal(1+1,3)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
from nose.tools import assert_equal
2+
from numpy.testing import assert_almost_equal
3+
from matplotlib.transforms import Affine2D
4+
import numpy as np
5+
6+
def test_Affine2D_from_values():
7+
points = [ [0,0],
8+
[10,20],
9+
[-1,0],
10+
]
11+
12+
t = Affine2D.from_values(1,0,0,0,0,0)
13+
actual = t.transform(points)
14+
expected = np.array( [[0,0],[10,0],[-1,0]] )
15+
assert_almost_equal(actual,expected)
16+
17+
t = Affine2D.from_values(0,2,0,0,0,0)
18+
actual = t.transform(points)
19+
expected = np.array( [[0,0],[0,20],[0,-2]] )
20+
assert_almost_equal(actual,expected)
21+
22+
t = Affine2D.from_values(0,0,3,0,0,0)
23+
actual = t.transform(points)
24+
expected = np.array( [[0,0],[60,0],[0,0]] )
25+
assert_almost_equal(actual,expected)
26+
27+
t = Affine2D.from_values(0,0,0,4,0,0)
28+
actual = t.transform(points)
29+
expected = np.array( [[0,0],[0,80],[0,0]] )
30+
assert_almost_equal(actual,expected)
31+
32+
t = Affine2D.from_values(0,0,0,0,5,0)
33+
actual = t.transform(points)
34+
expected = np.array( [[5,0],[5,0],[5,0]] )
35+
assert_almost_equal(actual,expected)
36+
37+
t = Affine2D.from_values(0,0,0,0,0,6)
38+
actual = t.transform(points)
39+
expected = np.array( [[0,6],[0,6],[0,6]] )
40+
assert_almost_equal(actual,expected)

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
'matplotlib.backends',
5252
'matplotlib.projections',
5353
'matplotlib.testing',
54+
'matplotlib.tests',
5455
# 'matplotlib.toolkits',
5556
'mpl_toolkits',
5657
'mpl_toolkits.mplot3d',

test/run-mpl-test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@
9090
sys.exit( 0 )
9191

9292
### Run nose
93+
args.append('.')
94+
args.append('matplotlib.tests.test_basic')
95+
args.append('matplotlib.tests.test_transforms')
9396
success = nose.run( argv = args,
9497
plugins = [ MplNosePlugin(), KnownFailure() ] )
9598

0 commit comments

Comments
 (0)