Skip to content

Commit abe4564

Browse files
authored
[test] Use limit_size in regex test failure reporting. NFC (#25516)
This avoids printing (for example) thousand line files when the matches fail. We were already using this helper for the non-regex case.
1 parent eef8433 commit abe4564

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,10 +1720,10 @@ def assertContained(self, values, string, additional_info='', regex=False):
17201720

17211721
if regex:
17221722
if type(values) is str:
1723-
self.assertTrue(re.search(values, string, re.DOTALL), 'Expected regex "%s" to match on:\n%s' % (values, string))
1723+
self.assertTrue(re.search(values, string, re.DOTALL), 'Expected regex "%s" to match on:\n%s' % (values, limit_size(string)))
17241724
else:
17251725
match_any = any(re.search(o, string, re.DOTALL) for o in values)
1726-
self.assertTrue(match_any, 'Expected at least one of "%s" to match on:\n%s' % (values, string))
1726+
self.assertTrue(match_any, 'Expected at least one of "%s" to match on:\n%s' % (values, limit_size(string)))
17271727
return
17281728

17291729
if type(values) not in [list, tuple]:

0 commit comments

Comments
 (0)