I spent a long time working on

  
https://sourceforge.net/tracker/index.php?func=detail&aid=2861426&group_id=80706&atid=560720

and the associated unit test.  I learned a lot and the unit tests really helped.

First, I decided that if someone sets the formatter or locator to be a
DateFormatter or DateLocator, then they are expressing their intention
to plot dates, so I triggered the axis unit conversion pipeline on
set_major_formatter(aDateFormatter) to use a DateConverter.  This
worked fine, but broke the JPL unit tests, because in their
EpochConverter, they have a *different* class that nonetheless
converts to the "datenum" floats, ie days since 0000-00-00, and thus
they also use the AutoDateFormatter and AutoDateLocator in their
AxisInfo converter info.

So what was happening is that the unit tests for the Epochs passed in
an Epoch instance, this triggered the unit conversion interface which
set the formatter to be an AutoDateFormatter, which triggered my new
code to use a DateConverter, which in turn broke the Epochs since the
DateConverter doesn't know how to hand;e an Epoch.  This is quite
subtle, but what is happening is that two different classes are
converting to the same floating point representation, and so both can
use the same Formatter and Locator, but we can't invert -- just
because we see a Formatter or Locator of a certain type, we can't
infer the class.

I would have never caught this w/o the unit test, would have happily
committed my "fix" while screwing up all the JPL stuff.

At the end of the day, after realizing all this, I decided the current
behavior was not a bug at all, and that mpl was doing what it was told
to do.  And there is no way to be smart here, since the use of a
DateFormatter does not imply you want a DateConverter.  So I simply
modified the DateFormatter code to raise with an intelligible message.

The question is: what to do with the unit test I wrote to expose the :
test_dates.test_empty_date_with_year_formatter

I can either leave it as a knownfailure, since that is what it is, or
modify it to set ax.xaxis_date as the traceback advises, and then add
the image comparison.

What do you think?

Another win for the unit tests, though they caused me to spend a lot
more time "fixing" this bug than I would have without them <wink>

JDH

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to