~caio1982/mojo/local_repo_keys

« back to all changes in this revision

Viewing changes to mojo/tests/utils.py

  • Committer: Tim Kuhlman
  • Date: 2016-01-11 21:50:39 UTC
  • mfrom: (255.1.2 bicommand-optional-etc)
  • Revision ID: timothy.kuhlman@canonical.com-20160111215039-mhnazq5d88j1q5ad
[pjdc, r=timkuhlman] testsuite updates to account for r254's changes to bicommand's calling convention; all 47 tests now pass

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
        os.mkdir(workspace.repo_dir)
41
41
        return workspace
42
42
 
 
43
    def assertSubsequenceInSequence(self, candidate, electorate):
 
44
        """Check if CANDIDATE is a subsequence of ELECTORATE.
 
45
        They must both be of mutually comparable sequence types."""
 
46
        clen = len(candidate)
 
47
        elen = len(electorate)
 
48
 
 
49
        for i in xrange(elen - clen + 1):
 
50
            if candidate == electorate[i:i+clen]:
 
51
                return
 
52
 
 
53
        self.fail(
 
54
            'Sequence {!r} is not a subsequence of {!r}'.format(
 
55
                candidate, electorate)
 
56
        )
 
57
 
43
58
 
44
59
# From http://stackoverflow.com/a/1160227/523729
45
60
def touch(filename, times=None):