Revision: 8459
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8459&view=rev
Author: mdboom
Date: 2010-06-23 14:44:32 +0000 (Wed, 23 Jun 2010)
Log Message:
-----------
Add unit test to ensure that rendering complexity exceeded exception is properly propagated to Python.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/tests/test_simplification.py
Modified: trunk/matplotlib/lib/matplotlib/tests/test_simplification.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/tests/test_simplification.py 2010-06-23 14:43:52 UTC (rev 8458)
+++ trunk/matplotlib/lib/matplotlib/tests/test_simplification.py 2010-06-23 14:44:32 UTC (rev 8459)
@@ -6,6 +6,10 @@
from pylab import *
import numpy as np
from matplotlib import patches, path, transforms
+
+from nose.tools import raises
+import cStringIO
+
nan = np.nan
Path = path.Path
@@ -165,6 +169,24 @@
assert len(segs) == 1
assert segs[0][1] == Path.MOVETO
+@raises(OverflowError)
+def test_throw_rendering_complexity_exceeded():
+ rcParams['path.simplify'] = False
+
+ xx = np.arange(200000)
+ yy = np.random.rand(200000)
+ yy[1000] = np.nan
+ fig = plt.figure()
+ ax = fig.add_subplot(111)
+ ax.plot(xx, yy)
+ try:
+ fig.savefig(cStringIO.StringIO())
+ except e:
+ raise e
+ else:
+ rcParams['path.simplify'] = True
+
+
if __name__=='__main__':
import nose
nose.runmodule(argv=['-s','--with-doctest'], exit=False)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|