Revision: 7678
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7678&view=rev
Author: jdh2358
Date: 2009-09-07 19:19:23 +0000 (Mon, 07 Sep 2009)
Log Message:
-----------
fix test_dates to chek for RuntimeError on identical date lim test
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/tests/test_dates.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-09-07 18:50:11 UTC (rev
7677)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-09-07 19:19:23 UTC (rev
7678)
@@ -2033,6 +2033,8 @@
if xmin is None: xmin = old_xmin
if xmax is None: xmax = old_xmax
+ if xmin==xmax:
+ warnings.warn('Attempting to set identical xmin==xmax results in
singular transformations; automatically expanding. xmin=%s, xmax=%s'%(xmin,
xmax))
xmin, xmax = mtransforms.nonsingular(xmin, xmax, increasing=False)
xmin, xmax = self.xaxis.limit_range_for_scale(xmin, xmax)
@@ -2205,6 +2207,9 @@
if ymin is None: ymin = old_ymin
if ymax is None: ymax = old_ymax
+ if ymin==ymax:
+ warnings.warn('Attempting to set identical ymin==ymax results in
singular transformations; automatically expanding. ymin=%s, ymax=%s'%(ymin,
ymax))
+
ymin, ymax = mtransforms.nonsingular(ymin, ymax, increasing=False)
ymin, ymax = self.yaxis.limit_range_for_scale(ymin, ymax)
self.viewLim.intervaly = (ymin, ymax)
Modified: trunk/matplotlib/lib/matplotlib/tests/test_dates.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/tests/test_dates.py 2009-09-07 18:50:11 UTC
(rev 7677)
+++ trunk/matplotlib/lib/matplotlib/tests/test_dates.py 2009-09-07 19:19:23 UTC
(rev 7678)
@@ -2,6 +2,7 @@
import numpy as np
from matplotlib.testing.decorators import image_comparison, knownfailureif
import matplotlib.pyplot as plt
+from nose.tools import assert_raises
@image_comparison(baseline_images=['date_empty'])
def test_date_empty():
@@ -66,13 +67,12 @@
fig.autofmt_xdate()
fig.savefig('date_axvline')
-# we want to test that this method raises a RuntimeError -- what is
-# the rightway to do this in the current framework
-...@knownfailureif(True)
-...@image_comparison(baseline_images=['date_xlim_empty'])
-def test_set_xlim_and_unexpected_handling():
+def test_too_many_date_ticks():
# Attempt to test SF 2715172, see
#
https://sourceforge.net/tracker/?func=detail&aid=2715172&group_id=80706&atid=560720
+ # setting equal datetimes triggers and expander call in
+ # transforms.nonsingular which results in too many ticks in the
+ # DayLocator. This should trigger a Locator.MAXTICKS RuntimeError
t0 = datetime.datetime(2000, 1, 20)
tf = datetime.datetime(2000, 1, 20)
fig = plt.figure()
@@ -81,13 +81,7 @@
ax.plot([],[])
from matplotlib.dates import DayLocator, DateFormatter, HourLocator
ax.xaxis.set_major_locator(DayLocator())
- ax.xaxis.set_major_formatter(DateFormatter("%m/%d/%y, %I:%M%p"))
- ax.xaxis.set_minor_locator(HourLocator())
- if 0:
- # this seems to cause an ininite loop.
- from nose.plugins.skip import SkipTest
- raise SkipTest('avoiding never-ending drawing')
- fig.savefig('date_xlim_empty')
+ assert_raises(RuntimeError, fig.savefig, 'junk.png')
if __name__=='__main__':
import nose
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins