##// END OF EJS Templates
tests: fix deprecation warning about regex flags not at beginning of expr...
Kyle Lippincott -
r44240:3fe91bcd default
parent child Browse files
Show More
@@ -1973,7 +1973,11 b' class TTest(Test):'
1973 @staticmethod
1973 @staticmethod
1974 def rematch(el, l):
1974 def rematch(el, l):
1975 try:
1975 try:
1976 el = b'(?:' + el + b')'
1976 # parse any flags at the beginning of the regex. Only 'i' is
1977 # supported right now, but this should be easy to extend.
1978 flags, el = re.match(br'^(\(\?i\))?(.*)', el).groups()[0:2]
1979 flags = flags or b''
1980 el = flags + b'(?:' + el + b')'
1977 # use \Z to ensure that the regex matches to the end of the string
1981 # use \Z to ensure that the regex matches to the end of the string
1978 if os.name == 'nt':
1982 if os.name == 'nt':
1979 return re.match(el + br'\r?\n\Z', l)
1983 return re.match(el + br'\r?\n\Z', l)
General Comments 0
You need to be logged in to leave comments. Login now