Skip to content

Provide unittest.TestCase.assertNotRegexpMatches #52286

Closed

Description

@voidspace
BPO 8038
Nosy @ezio-melotti, @voidspace
Files
  • assertNotRegexpMatches.patch: patch with assertNotRegexpMatches.
  • 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/voidspace'
    closed_at = <Date 2010-05-08.16:42:16.243>
    created_at = <Date 2010-03-02.13:57:45.080>
    labels = ['type-bug', 'library']
    title = 'Provide unittest.TestCase.assertNotRegexpMatches'
    updated_at = <Date 2010-05-08.16:42:16.242>
    user = 'https://github.com/voidspace'

    bugs.python.org fields:

    activity = <Date 2010-05-08.16:42:16.242>
    actor = 'michael.foord'
    assignee = 'michael.foord'
    closed = True
    closed_date = <Date 2010-05-08.16:42:16.243>
    closer = 'michael.foord'
    components = ['Library (Lib)']
    creation = <Date 2010-03-02.13:57:45.080>
    creator = 'michael.foord'
    dependencies = []
    files = ['16498']
    hgrepos = []
    issue_num = 8038
    keywords = ['patch']
    message_count = 6.0
    messages = ['100291', '100292', '100616', '100664', '102211', '105313']
    nosy_count = 3.0
    nosy_names = ['ezio.melotti', 'michael.foord', 'Ryszard.Szopa']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue8038'
    versions = ['Python 2.7', 'Python 3.2']

    Activity

    1. voidspace commented on Mar 2, 2010

      @voidspace
      ContributorAuthor

      Originally reported as a bug against unittest2: http://code.google.com/p/unittest-ext/issues/detail?id=3

      There are some assert* methods that don't have their assertNot*
      counterparts. There's assertDictEqual, assertSequenceEqual,
      assertRegexpMatches, but no assertDictNotEqual, assertSequenceNotEqual,
      assertRegexpNotMatches, for example.

      They should be present for the sake of completeness (I don't like to have to look into the docs to check if a method has a negative counterpart), but also because they ask for a custom output. For example, the error accompanying assertRegexpNotMatches could show the matching part of the text, which is the part that really interests me. assert_(re.match(...)) will only tell me that None is not true...

    2. self-assigned this
      on Mar 2, 2010
    3. added
      stdlib
      type-bug
      on Mar 2, 2010
    4. voidspace commented on Mar 2, 2010

      @voidspace
      ContributorAuthor

      Should there be a 'discussion' stage for the tracker?

      This isn't *really* at the 'test needed' stage, I'm not 100% convinced we should add all these extra methods just 'for the sake of completeness' - but if they are *needed* they should be added.

    5. RyszardSzopa commented on Mar 7, 2010

      RyszardSzopamannequin
      Mannequin

      Hi,

      I am the original reporter of the bug. Please forgive me if this is not the place for discussing the issue.

      I've thought about it, and stuff like assertDictNotEqual or assertSequenceNotEqual aren't really necessary - it is much easier (and shorter) to use assertNotEqual, and there's no need for any special formatting needed to say that something is equal when it shouldn't.

      This is not the case for assertNotRegexpMatches, though. assertNot(re.match(...)) tells me only that False is not True. I'd like it to say *how* the text matches the regex (the matching part that is). (Sorry for repeating myself, I try to be clearer this time.)

      So, this issue could be renamed to "Implement assertNotRegexpMatches."

    6. changed the title [-]Not all the new assert* unittest.TestCase methods have negative (not) equivalents[/-] [+]Provide unittest.TestCase.assertNotRegexpMatches[/+] on Mar 7, 2010
    7. RyszardSzopa commented on Mar 8, 2010

      RyszardSzopamannequin
      Mannequin

      Here's the patch against unittest2 that implements assertNotRegexpMatches.

    8. voidspace commented on Apr 2, 2010

      @voidspace
      ContributorAuthor

      Committed revision 79632.

    9. voidspace commented on May 8, 2010

      @voidspace
      ContributorAuthor

      Docstrings committed revision 80990.

    10. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    stdlibtype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions