You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Esteve Fernandez (JIRA)" <ji...@apache.org> on 2008/08/13 15:46:44 UTC

[jira] Created: (THRIFT-109) Python unit tests should use self.assert*

Python unit tests should use self.assert*
-----------------------------------------

                 Key: THRIFT-109
                 URL: https://issues.apache.org/jira/browse/THRIFT-109
             Project: Thrift
          Issue Type: Improvement
          Components: Test Suite
            Reporter: Esteve Fernandez
         Attachments: py_unittests.patch

In some of tests in the current testsuite for Python use, "assert EXPR" instead of the standard self.assert* methods. It's recommended using these methods as they give more information in case an assertion fails.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-109) Python unit tests should use self.assert*

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638076#action_12638076 ] 

David Reiss commented on THRIFT-109:
------------------------------------

bq. Anyway, I concur that assertAlmostEqual might not be the most appropiate method here, what about self.assert_(time.time() - starttime < 5.0) ?
Sounds good.  Do you want to post an updated patch?

bq. self.assert* should receive the expected value as the first argument and the resulting one as the second.
I personally like it the other way, but personal preferences aside, it look like the few examples here: http://www.python.org/doc/2.5.2/lib/module-unittest.html have the actual value first and the expected value second.  Obviously, this is  not a critically important issue.

> Python unit tests should use self.assert*
> -----------------------------------------
>
>                 Key: THRIFT-109
>                 URL: https://issues.apache.org/jira/browse/THRIFT-109
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Test Suite
>            Reporter: Esteve Fernandez
>            Priority: Minor
>         Attachments: py_unittests.patch
>
>
> In some of tests in the current testsuite for Python use, "assert EXPR" instead of the standard self.assert* methods. It's recommended using these methods as they give more information in case an assertion fails.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (THRIFT-109) Python unit tests should use self.assert*

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Reiss resolved THRIFT-109.
--------------------------------

    Resolution: Fixed
      Assignee: Esteve Fernandez

> Python unit tests should use self.assert*
> -----------------------------------------
>
>                 Key: THRIFT-109
>                 URL: https://issues.apache.org/jira/browse/THRIFT-109
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Test Suite
>            Reporter: Esteve Fernandez
>            Assignee: Esteve Fernandez
>            Priority: Minor
>         Attachments: py_unittests.patch, py_unittests_2.patch
>
>
> In some of tests in the current testsuite for Python use, "assert EXPR" instead of the standard self.assert* methods. It's recommended using these methods as they give more information in case an assertion fails.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-109) Python unit tests should use self.assert*

Posted by "Esteve Fernandez (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Esteve Fernandez updated THRIFT-109:
------------------------------------

    Attachment: py_unittests_2.patch

Version 2, uses self.assert_ instead of self.assertAlmostEquals and restores the original order in the serialization tests

> Python unit tests should use self.assert*
> -----------------------------------------
>
>                 Key: THRIFT-109
>                 URL: https://issues.apache.org/jira/browse/THRIFT-109
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Test Suite
>            Reporter: Esteve Fernandez
>            Priority: Minor
>         Attachments: py_unittests.patch, py_unittests_2.patch
>
>
> In some of tests in the current testsuite for Python use, "assert EXPR" instead of the standard self.assert* methods. It's recommended using these methods as they give more information in case an assertion fails.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-109) Python unit tests should use self.assert*

Posted by "Esteve Fernandez (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Esteve Fernandez updated THRIFT-109:
------------------------------------

    Priority: Minor  (was: Major)

> Python unit tests should use self.assert*
> -----------------------------------------
>
>                 Key: THRIFT-109
>                 URL: https://issues.apache.org/jira/browse/THRIFT-109
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Test Suite
>            Reporter: Esteve Fernandez
>            Priority: Minor
>         Attachments: py_unittests.patch
>
>
> In some of tests in the current testsuite for Python use, "assert EXPR" instead of the standard self.assert* methods. It's recommended using these methods as they give more information in case an assertion fails.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-109) Python unit tests should use self.assert*

Posted by "Esteve Fernandez (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Esteve Fernandez updated THRIFT-109:
------------------------------------

    Attachment: py_unittests.patch

> Python unit tests should use self.assert*
> -----------------------------------------
>
>                 Key: THRIFT-109
>                 URL: https://issues.apache.org/jira/browse/THRIFT-109
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Test Suite
>            Reporter: Esteve Fernandez
>         Attachments: py_unittests.patch
>
>
> In some of tests in the current testsuite for Python use, "assert EXPR" instead of the standard self.assert* methods. It's recommended using these methods as they give more information in case an assertion fails.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-109) Python unit tests should use self.assert*

Posted by "Esteve Fernandez (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637982#action_12637982 ] 

Esteve Fernandez commented on THRIFT-109:
-----------------------------------------

> I don't think assertAlmostEqual is correct here because we are checking against a timeout
> (though I'm not sure that these tests are correct).

Well, I must agree that these tests are a bit crufty, since timeouts may vary. Anyway, I concur that assertAlmostEqual might not be the most appropiate method here, what about self.assert_(time.time() - starttime < 5.0) ?

> Also, why did you reverse the order in the comparisons?

Just like their Java counterpart, as a convention, self.assert* should receive the expected value as the first argument and the resulting one as the second.

> Python unit tests should use self.assert*
> -----------------------------------------
>
>                 Key: THRIFT-109
>                 URL: https://issues.apache.org/jira/browse/THRIFT-109
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Test Suite
>            Reporter: Esteve Fernandez
>            Priority: Minor
>         Attachments: py_unittests.patch
>
>
> In some of tests in the current testsuite for Python use, "assert EXPR" instead of the standard self.assert* methods. It's recommended using these methods as they give more information in case an assertion fails.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-109) Python unit tests should use self.assert*

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637660#action_12637660 ] 

David Reiss commented on THRIFT-109:
------------------------------------

I don't think assertAlmostEqual is correct here because we are checking against a timeout (though I'm not sure that these tests are correct).

Also, why did you reverse the order in the comparisons?

> Python unit tests should use self.assert*
> -----------------------------------------
>
>                 Key: THRIFT-109
>                 URL: https://issues.apache.org/jira/browse/THRIFT-109
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Test Suite
>            Reporter: Esteve Fernandez
>            Priority: Minor
>         Attachments: py_unittests.patch
>
>
> In some of tests in the current testsuite for Python use, "assert EXPR" instead of the standard self.assert* methods. It's recommended using these methods as they give more information in case an assertion fails.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.