Mercurial > p > roundup > code
view test/cmp_helper.py @ 6416:99d344aa825d
- issue2550648 - keyword boolean search multiple issues
Fix issue where saving the keyword boolean search would remove the
link to open the editor.
Note that re-opening the editor starts with a blank operation. It does
not inherit the existing expression.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 19 May 2021 20:41:58 -0400 |
| parents | 19bd4b413ed6 |
| children |
line wrap: on
line source
class StringFragmentCmpHelper: def compareStringFragments(self, s, fragments): """Compare a string agains a list of fragments where a tuple denotes a set of alternatives """ pos = 0 for frag in fragments: if type(frag) != tuple: self.assertEqual(s[pos:pos + len(frag)], frag) pos += len(frag) else: found = False for alt in frag: if s[pos:pos + len(alt)] == alt: pos += len(alt) found = True break if not found: l = max(map(len, frag)) raise AssertionError('%s != %s' % (repr(s[pos:pos + l]), str(frag))) self.assertEqual(s[pos:], '')
