Author mnewman
Recipients mnewman
Date 2010-02-18.12:26:50
SpamBayes Score 4.51154e-11
Marked as misclassified No
Message-id <1266496014.66.0.425338547188.issue7956@psf.upfronthosting.co.za>
In-reply-to
Content
The attached example unit test file shows that assertDictContainsSubset cannot handle error messages that need to show integer keys. Below is the output of the test suite, where "test_mixed_keys_fail" has an error (code mistake), while "test_text_keys_fail" produces a failure (result mistake) as expected.

C:\notes>C:\Python31\python.exe test_one_and_one.py
.E.F
======================================================================
ERROR: test_mixed_keys_fail (__main__.Test_one_and_one)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_one_and_one.py", line 30, in test_mixed_keys_fail
    self.assertDictContainsSubset({3: "this does not exist"}, self.dict_with_mix
ed_keys)
  File "C:\python31\lib\unittest.py", line 908, in assertDictContainsSubset
    standardMsg = 'Missing: %r' % ','.join(missing)
TypeError: sequence item 0: expected str instance, int found

======================================================================
FAIL: test_text_keys_fail (__main__.Test_one_and_one)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_one_and_one.py", line 33, in test_text_keys_fail
    self.assertDictContainsSubset({"3": "this does not exist"}, self.dict_with_t
ext_keys)
AssertionError: Missing: '3'

----------------------------------------------------------------------
Ran 4 tests in 0.010s

FAILED (failures=1, errors=1)
History
Date User Action Args
2010-02-18 12:26:55mnewmansetrecipients: + mnewman
2010-02-18 12:26:54mnewmansetmessageid: <1266496014.66.0.425338547188.issue7956@psf.upfronthosting.co.za>
2010-02-18 12:26:52mnewmanlinkissue7956 messages
2010-02-18 12:26:51mnewmancreate