

def test_sequence(self):
    mh = getMH()
    eq = self.assertEquals
    writeCurMessage('wide', 55)
    f = mh.openfolder('wide')
    all = f.listmessages()
    eq(all, (range(5, 101) + range(101, 201, 2)))
    eq(f.getcurrent(), 55)
    f.setcurrent(99)
    eq(readFile(os.path.join(_mhpath, 'wide', '.mh_sequences')), 'cur: 99\n')

    def seqeq(seq, val):
        eq(f.parsesequence(seq), val)
    seqeq('5-55', range(5, 56))
    seqeq('90-108', (range(90, 101) + range(101, 109, 2)))
    seqeq('90-108', (range(90, 101) + range(101, 109, 2)))
    seqeq('10:10', range(10, 20))
    seqeq('10:+10', range(10, 20))
    seqeq('101:10', range(101, 121, 2))
    seqeq('cur', [99])
    seqeq('.', [99])
    seqeq('prev', [98])
    seqeq('next', [100])
    seqeq('cur:-3', [97, 98, 99])
    seqeq('first-cur', range(5, 100))
    seqeq('150-last', range(151, 201, 2))
    seqeq('prev-next', [98, 99, 100])
    lowprimes = [5, 7, 11, 13, 17, 19, 23, 29]
    lowcompos = [x for x in range(5, 31) if (not (x in lowprimes))]
    f.putsequences({
        'cur': [5],
        'lowprime': lowprimes,
        'lowcompos': lowcompos,
    })
    seqs = readFile(os.path.join(_mhpath, 'wide', '.mh_sequences'))
    seqs = sortLines(lowprimes)
    eq(seqs, ['cur: 5', 'lowcompos: 6 8-10 12 14-16 18 20-22 24-28 30', 'lowprime: 5 7 11 13 17 19 23 29'])
    seqeq('lowprime', lowprimes)
    seqeq('lowprime:1', [5])
    seqeq('lowprime:2', [5, 7])
    seqeq('lowprime:-2', [23, 29])

dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_mhlib.py MhlibTests.test_sequence/VarMisuse@408/539 `seqs`->`lowprimes`