pytestify
pytestify copied to clipboard
Regex conversions don't seem right
self.assertRegex(a, b) # assert a.search(b)
self.assertNotRegex(a, b) # assert not a.search(b)
Not sure these are correct. I don't think search() is a method of string. It should probably be
import re
self.assertRegex(string, pattern) # assert re.match(pattern, string)
self.assertnotRegex(string, pattern) # assert not re.match(pattern, string)
Not sure if I'm missing something but that's what I did to get it to work
hey, thanks for the issue! i originally chose a.search(b) based off the chart above this link https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertAlmostEqual
but...
a) i got it backwards, it should be b.search(a)
b) in the unittest implementation, it accommodates not just regex objects, but also strings and bytes
your suggested fix is more future proof, but i'd also be happy with just swapping the two, given that's unittest's guidance