Title: Additional tests for email module
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 3.3, Python 2.7
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: r.david.murray Nosy List: michael.henry, python-dev, r.david.murray, santoso.wijaya
Priority: normal Keywords: needs review, patch

Created on 2011-03-17 15:55 by michael.henry, last changed 2011-03-23 18:38 by r.david.murray. This issue is now closed.

File name Uploaded Description Edit
test_email_additional_tests.patch michael.henry, 2011-03-17 15:55 Extends the tests in review
Messages (5)
msg131263 - (view) Author: Michael Henry (michael.henry) * Date: 2011-03-17 15:55
The attached patch includes additional unit tests for the email module,
and splits pre-existing test_header_encode() and test_decode() functions
into individual test functions.
msg131348 - (view) Author: Santoso Wijaya (santoso.wijaya) * Date: 2011-03-18 18:19
Do we need each sample--(input -> expected output)--to be its own unittest function?

Why not something like (pseudo-code):

expected = {
  'input1': 'output1',
  'input2': 'output2',

def test_encode(self):    # collapse all
    for input, output in expected.items():
        self._encode(input, output)    # test logic
msg131359 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-03-18 19:42
Until unittest learns to do parameterized tests, it's nice to have each test be separate so that you can easily see which test cases are failing.  (A number of the existing email tests have a lot of tests in each "unit" test, and this can make debugging more difficult, as I know well.)

I've been known to synthesize parameterized tests in my unit tests to save myself some typing, but Michael has already done the typing here...
msg131904 - (view) Author: Roundup Robot (python-dev) Date: 2011-03-23 18:34
New changeset 3dbea3fa73fb by R David Murray in branch '3.1':
#11589: add additional tests for the email quoprimime module.

New changeset 04c9c831803b by R David Murray in branch '3.2':
Merge #11589: add additional tests for the email quoprimime module.

New changeset 2f4865834695 by R David Murray in branch 'default':
Merge #11589: add additional tests for the email quoprimime module.
msg131905 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-03-23 18:38
Thanks, Michael!  I tweaked the patch slightly: deleted that test-writing-helper check you had marked with the XXX, and renamed the helper test methods to _test_XXX.  I also didn't wind up applying it to 2.7 because hg doesn't support merge markers when doing a transplant and there were conflicts.  Not worth the extra effort that would be required.
Date User Action Args
2011-03-23 18:38:16r.david.murraysetstatus: open -> closed
resolution: accepted
messages: + msg131905

stage: patch review -> resolved
2011-03-23 18:34:35python-devsetnosy: + python-dev
messages: + msg131904
2011-03-18 19:42:42r.david.murraysetmessages: + msg131359
2011-03-18 18:19:09santoso.wijayasetnosy: + santoso.wijaya
messages: + msg131348
2011-03-17 23:53:39eric.araujosetkeywords: + needs review
assignee: r.david.murray
stage: patch review
title: Unit test extensions for email module -> Additional tests for email module
versions: + Python 3.1, Python 2.7, Python 3.2, Python 3.3
2011-03-17 15:55:49michael.henrycreate