where's self.assertMatch (for Django)?

Discussion in 'Python' started by Phlip, Oct 14, 2009.

  1. Phlip

    Phlip Guest

    Hypo Nt:

    Been a while, now I'm back, and the first helpless question is...

    When I google (including codesearch) for assertMatch, I get a mishmash of
    opinions. Am I missing the One True assertMatch(), or isn't there one and I
    gotta write it? or copy and use one of the pretenders?

    Distractingly-yrs,

    --
    Phlip
    http://zeekland.zeroplayer.com/Pigleg_Too/1
    Phlip, Oct 14, 2009
    #1
    1. Advertising

  2. Phlip

    Phlip Guest

    > When I google (including codesearch) for assertMatch, I get a mishmash of
    > opinions. Am I missing the One True assertMatch(), or isn't there one and I
    > gotta write it? or copy and use one of the pretenders?


    Ookay, try this:

    def assertMatch(self, pattern, slug):
    r = re.compile(pattern)
    self.assertNotEqual(None, r.search(smart_str(slug)))

    To do: Pass thru an optional diagnostic message.

    Anyone know why this is not in PyUnit?

    > --
    >    Phlip
    >    http://zeekland.zeroplayer.com/Pigleg_Too/1
    Phlip, Oct 15, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ralf W. Grosse-Kunstleve
    Replies:
    16
    Views:
    559
    Lonnie Princehouse
    Jul 11, 2005
  2. Ralf W. Grosse-Kunstleve
    Replies:
    18
    Views:
    578
    Bengt Richter
    Jul 11, 2005
  3. Ralf W. Grosse-Kunstleve
    Replies:
    2
    Views:
    387
    Dan Sommers
    Jul 12, 2005
  4. falcon
    Replies:
    0
    Views:
    357
    falcon
    Jul 31, 2005
  5. Bart Kastermans
    Replies:
    6
    Views:
    383
    Bart Kastermans
    Jul 13, 2008
Loading...

Share This Page