classification
Title: Additional tests for email module
Type: Stage: committed/rejected
Components: Library (Lib) Versions: Python 3.3, Python 3.2, Python 3.1, Python 2.7
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: r.david.murray Nosy List: michael.henry, python-dev, r.david.murray, santa4nt
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.

Files
File name Uploaded Description Edit
test_email_additional_tests.patch michael.henry, 2011-03-17 15:55 Extends the tests in test_email.py 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 (santa4nt) * 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.
http://hg.python.org/cpython/rev/3dbea3fa73fb

New changeset 04c9c831803b by R David Murray in branch '3.2':
Merge #11589: add additional tests for the email quoprimime module.
http://hg.python.org/cpython/rev/04c9c831803b

New changeset 2f4865834695 by R David Murray in branch 'default':
Merge #11589: add additional tests for the email quoprimime module.
http://hg.python.org/cpython/rev/2f4865834695
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.
History
Date User Action Args
2011-03-23 18:38:16r.david.murraysetstatus: open -> closed
resolution: accepted
messages: + msg131905

stage: patch review -> committed/rejected
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:09santa4ntsetnosy: + santa4nt
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