[yt-dev] Simple answer testing now in 3.0

Matthew Turk matthewturk at gmail.com
Mon Jan 27 05:05:02 PST 2014


Hi all,

Just as a quick note, Britton, Nathan and I came up with a very simple
answer testing mechanism.  Originally we did this for the unit
refactor.  Here's the PR, with some explanation:

https://bitbucket.org/MatthewTurk/yt/pull-request/36/adding-simple-answer-testing

This will be added to the docs soon, but the long and the short is
that if you can define a function that returns an array, you can
easily check that the answer remains the same by comparing
min,max,sum,std,size, and (optionally) the hash.  You just have to do
something like this:

http://paste.yt-project.org/show/4239/

or,

http://paste.yt-project.org/show/4245/

If you run with --answer-reference on the command line, it stores, and
if not, it compares.  It'll also pop off a result_basename kwarg to
the function in case you want to run it multiple times with different
result names.

Anyway, I've just pushed it into the main 3.0 branch, and at some
point it should probably be added to the 2.x branch too.

-Matt



More information about the yt-dev mailing list