Mercurial > p > roundup > code
view test/cmp_helper.py @ 6545:5a3a386aa8e7
issue2551179 Load config_ini.ini ... recognize minimal template demo.py
Mostly taken from patch by John Kristensen (jerrykan).
Tests for python3 and 2 created for minimal and jinja2 templates.
Removed FIXME for special case config settings for jinja and
responsive templates. config_ini.ini mechanism makes it obsolete.
Demo removes config_ini.ini file in home directory.
Also remove encoding of utf-8 from initial_data.py to remove
SyntaxError: encoding declaration in Unicode string
under python2.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 09 Dec 2021 15:26:39 -0500 |
| 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:], '')
