Beispiel #1
0
 def test_uneven_increments(self):
     with assert_raises(ValueError):
         _range_to_slice([1, 1, 2, 3, 5, 8, 13])
Beispiel #2
0
 def test_negative_elements(self):
     with assert_raises(ValueError):
         _range_to_slice([-1, -2, -3, -4])
Beispiel #3
0
 def test_zero_increments(self):
     with assert_raises(ValueError):
         _range_to_slice([1, 1, 1, 1])
Beispiel #4
0
 def _check_slice(start, stop, step):
     s = slice(start, stop, step)
     length = max(start, 0 if stop is None else stop) + 1
     r = slice_to_range(s, length)
     assert_equal(_range_to_slice(r), s)