This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author zaitcev
Recipients zaitcev
Date 2014-02-27.16:40:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1393519242.26.0.28804654783.issue20798@psf.upfronthosting.co.za>
In-reply-to
Content
When using an assert such as self.assertEquals(tester(), expected), an error message suggests wrong argument order (as in, not the order in examples in the documentation). Apparently this is confusing enough that OpenStack even opened a whole bunch of bugs and filed patches to swap the order in the tests:
 https://bugs.launchpad.net/ceilometer/+bug/1277104

If the code is:

import testtools

class TestConfigTrueValue(testtools.TestCase):
    def test_testEquals(self):
        reference = "reference-0123456789012345678901234567890123456789"
        def function_under_test():
            return "actual-0123456789012345678901234567890123456789"
        self.assertEquals(function_under_test(), reference)

then running it yields

[zaitcev@guren xxx]$ python3 -c 'import nose; nose.main()'
F
======================================================================
FAIL: testic.TestConfigTrueValue.test_testEquals
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/q/zaitcev/tmp/xxx/testic.py", line 10, in test_testEquals
    self.assertEquals(function_under_test(), reference)
  File "/usr/lib/python3.3/site-packages/testtools/testcase.py", line 322, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/usr/lib/python3.3/site-packages/testtools/testcase.py", line 417, in assertThat
    raise MismatchError(matchee, matcher, mismatch, verbose)
testtools.matchers._impl.MismatchError: !=:
reference = 'actual-0123456789012345678901234567890123456789'
actual    = 'reference-0123456789012345678901234567890123456789'
History
Date User Action Args
2014-02-27 16:40:42zaitcevsetrecipients: + zaitcev
2014-02-27 16:40:42zaitcevsetmessageid: <1393519242.26.0.28804654783.issue20798@psf.upfronthosting.co.za>
2014-02-27 16:40:42zaitcevlinkissue20798 messages
2014-02-27 16:40:41zaitcevcreate