climate-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLIMATE-399) Use functions in numpy.testing for unit tests involving array comparisons
Date Sun, 06 Apr 2014 22:49:15 GMT

    [ https://issues.apache.org/jira/browse/CLIMATE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13961557#comment-13961557
] 

ASF GitHub Bot commented on CLIMATE-399:
----------------------------------------

Github user asfgit closed the pull request at:

    https://github.com/apache/climate/pull/17


> Use functions in numpy.testing for unit tests involving array comparisons
> -------------------------------------------------------------------------
>
>                 Key: CLIMATE-399
>                 URL: https://issues.apache.org/jira/browse/CLIMATE-399
>             Project: Apache Open Climate Workbench
>          Issue Type: Improvement
>          Components: general
>    Affects Versions: 0.3-incubating
>            Reporter: Alex Goodman
>            Assignee: Alex Goodman
>             Fix For: 0.4
>
>
> Currently our unit tests for numpy array equality look something like this:
> {code}
> self.assertTrue(np.arrray_equal(x, y))
> {code}
> which could raise the following exception:
> {code}
> AssertionError:
> False is not true
> {code}
> This indeed tells us if the test has failed, but it would be better if the output could
show where the arrays were inconsistent. The functions included in numpy.testing fulfill this
purpose, and are widely used in other projects depending on numpy arrays. Therefore we should
replace all instances of the above example with:
> {code}
> np.testing.assert_array_equal(x, y)
> {code}
> Which could raise exceptions like:
> {code}
> AssertionError:
> Arrays are not equal
> (mismatch 100.0%)
>  x: array([ 1.        ,  3,         7])
>  y: array([ -2.        ,  -4,         -6])
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message