Exemplo n.º 1
0
 def test_find_runs_offset(self):
     # because of the nature of the find_runs algorithm, there may be
     # fencepost errors with runs that start at x[1] or x[-2]
     x = array([10, 12, 13, 14, 28, 16])
     assert_equal(find_runs(x), [[10], [12, 13, 14], [28], [16]])
     x = array([10, 15, 16, 17, 34])
     assert_equal(find_runs(x), [[10], [15, 16, 17], [34]])
Exemplo n.º 2
0
 def test_find_runs_offset(self):
     # because of the nature of the find_runs algorithm, there may be
     # fencepost errors with runs that start at x[1] or x[-2]
     x = array([10, 12, 13, 14, 28, 16])
     assert_equal(find_runs(x), [[10], [12, 13, 14], [28], [16]])
     x = array([10, 15, 16, 17, 34])
     assert_equal(find_runs(x), [[10], [15, 16, 17], [34]])
Exemplo n.º 3
0
 def test_find_runs_flat(self):
     x = array([0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0])
     assert_equal(find_runs(x, order="flat"), [[0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0]])
Exemplo n.º 4
0
 def test_find_runs_descending(self):
     x = array([30, 41, 40, 39, 38, 37, 12])
     assert_equal(find_runs(x, order="descending"), [[30], [41, 40, 39, 38, 37], [12]])
Exemplo n.º 5
0
 def test_find_runs_none(self):
     x = array([])
     assert_equal(find_runs(x), [])
     x = array([12, 15, 27])
     assert_equal(find_runs(x), [[12], [15], [27]])
Exemplo n.º 6
0
 def test_find_runs_end(self):
     x = array([18, 23, 24, 25])
     assert_equal(find_runs(x), [[18], [23, 24, 25]])
Exemplo n.º 7
0
 def test_find_runs_start(self):
     x = array([3, 4, 5, 12, 9, 17])
     assert_equal(find_runs(x), [[3, 4, 5], [12], [9], [17]])
Exemplo n.º 8
0
 def test_find_runs_middle(self):
     x = array([0, 8, 7, 8, 9, 2, 3, 4, 10])
     assert_equal(find_runs(x), [[0], [8], [7, 8, 9], [2, 3, 4], [10]])
Exemplo n.º 9
0
 def test_find_runs_descending(self):
     x = array([30, 41, 40, 39, 38, 37, 12])
     assert_equal(find_runs(x, order='descending') , \
                         [[30], [41,40,39,38,37], [12]])
Exemplo n.º 10
0
 def test_find_runs_none(self):
     x = array([])
     assert_equal(find_runs(x), [])
     x = array([12, 15, 27])
     assert_equal(find_runs(x), [[12], [15], [27]])
Exemplo n.º 11
0
 def test_find_runs_end(self):
     x = array([18, 23, 24, 25])
     assert_equal(find_runs(x), [[18], [23, 24, 25]])
Exemplo n.º 12
0
 def test_find_runs_start(self):
     x = array([3, 4, 5, 12, 9, 17])
     assert_equal(find_runs(x), [[3, 4, 5], [12], [9], [17]])
Exemplo n.º 13
0
 def test_find_runs_middle(self):
     x = array([0, 8, 7, 8, 9, 2, 3, 4, 10])
     assert_equal(find_runs(x), [[0], [8], [7, 8, 9], [2, 3, 4], [10]])