Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional tests for email module #55798

Closed
michaelhenry mannequin opened this issue Mar 17, 2011 · 5 comments
Closed

Additional tests for email module #55798

michaelhenry mannequin opened this issue Mar 17, 2011 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@michaelhenry
Copy link
Mannequin

michaelhenry mannequin commented Mar 17, 2011

BPO 11589
Nosy @bitdancer
Files
  • test_email_additional_tests.patch: Extends the tests in test_email.py
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/bitdancer'
    closed_at = <Date 2011-03-23.18:38:16.276>
    created_at = <Date 2011-03-17.15:55:49.231>
    labels = ['library']
    title = 'Additional tests for email module'
    updated_at = <Date 2011-03-23.18:38:16.275>
    user = 'https://bugs.python.org/michaelhenry'

    bugs.python.org fields:

    activity = <Date 2011-03-23.18:38:16.275>
    actor = 'r.david.murray'
    assignee = 'r.david.murray'
    closed = True
    closed_date = <Date 2011-03-23.18:38:16.276>
    closer = 'r.david.murray'
    components = ['Library (Lib)']
    creation = <Date 2011-03-17.15:55:49.231>
    creator = 'michael.henry'
    dependencies = []
    files = ['21269']
    hgrepos = []
    issue_num = 11589
    keywords = ['patch', 'needs review']
    message_count = 5.0
    messages = ['131263', '131348', '131359', '131904', '131905']
    nosy_count = 4.0
    nosy_names = ['r.david.murray', 'santoso.wijaya', 'python-dev', 'michael.henry']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue11589'
    versions = ['Python 3.1', 'Python 2.7', 'Python 3.2', 'Python 3.3']

    @michaelhenry
    Copy link
    Mannequin Author

    michaelhenry mannequin commented Mar 17, 2011

    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.

    @michaelhenry michaelhenry mannequin added the stdlib Python modules in the Lib dir label Mar 17, 2011
    @merwok merwok changed the title Unit test extensions for email module Additional tests for email module Mar 17, 2011
    @santosowijaya
    Copy link
    Mannequin

    santosowijaya mannequin commented Mar 18, 2011

    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

    @bitdancer
    Copy link
    Member

    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...

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 23, 2011

    New changeset 3dbea3fa73fb by R David Murray in branch '3.1':
    bpo-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 bpo-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 bpo-11589: add additional tests for the email quoprimime module.
    http://hg.python.org/cpython/rev/2f4865834695

    @bitdancer
    Copy link
    Member

    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.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant