Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of assertRegexMatches in python 2.4

Say I have a regex

REGEX = re.compile('.*foo{')

How would you write a unit test that matches a set of string with python 2.4 ?

I know in python 2.7 I can use assertRegexMatches, unfortunately this doesn't work in 2.4 :/

I use self.assertEqual for the rest of my tests.

Cheers, M

like image 427
Martin Avatar asked Dec 17 '22 22:12

Martin


1 Answers

self.assertTrue(REGEX.match(text))
like image 102
leoluk Avatar answered Jan 03 '23 11:01

leoluk