def length_invariant(s1, minlength, maxlength): l1 = len(s1) for sub in substrings(s1, minlength): assert (minlength <= len(sub) <= min(l1, maxlength))
def test_null(self): assert (list(substrings('abc', 4, 20)) == [])
def test_string(self): assert (set(list(substrings('abcde', 3, 20))) == set(['abc', 'abcd', 'abcde', 'bcd', 'bcde', 'cde']))
def test_triv(self): assert (list(substrings('abc', 3, 20)) == ['abc'])