where's self.assertMatch (for Django)?

Phlip phlip2005 at gmail.com
Thu Oct 15 13:05:38 EDT 2009


> 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




More information about the Python-list mailing list