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