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

Skip to content

Commit 6bac443

Browse files
committed
add basic image interp unit test
svn path=/trunk/matplotlib/; revision=7705
1 parent 3c2d910 commit 6bac443

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

66.3 KB
Loading

lib/matplotlib/tests/test_image.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import numpy as np
2+
3+
from matplotlib.testing.decorators import image_comparison, knownfailureif
4+
import matplotlib.pyplot as plt
5+
from nose.tools import assert_raises
6+
7+
@image_comparison(baseline_images=['image_interps'])
8+
def test_image_interps():
9+
'make the basic nearest, bilinear and bicubic interps'
10+
X = np.arange(100)
11+
X = X.reshape(5, 20)
12+
13+
fig = plt.figure()
14+
ax1 = fig.add_subplot(311)
15+
ax1.imshow(X, interpolation='nearest')
16+
ax1.set_title('three interpolations')
17+
ax1.set_ylabel('nearest')
18+
19+
ax2 = fig.add_subplot(312)
20+
ax2.imshow(X, interpolation='bilinear')
21+
ax2.set_ylabel('bilinear')
22+
23+
ax3 = fig.add_subplot(313)
24+
ax3.imshow(X, interpolation='bicubic')
25+
ax3.set_ylabel('bicubic')
26+
27+
fig.savefig('image_interps')
28+
29+
if __name__=='__main__':
30+
import nose
31+
nose.runmodule(argv=['-s','--with-doctest'], exit=False)

0 commit comments

Comments
 (0)