Exemplo n.º 1
0
 def test_skip(self):
     for skip in [0, 3, 13]:
         r1 = DataInMemory(self.d)
         out_with_skip = r1.get_output(skip=skip)[0]
         r2 = DataInMemory(self.d)
         out = r2.get_output()[0]
         np.testing.assert_almost_equal(out_with_skip, out[skip::],
                                        err_msg="The first %s rows were skipped, but that did not "
                                                "match the rows with skip=0 and sliced by [%s::]" % (skip, skip))
Exemplo n.º 2
0
 def test_skip_input_list(self):
     for skip in [0, 3, 13]:
         r1 = DataInMemory([self.d, self.d])
         out_with_skip = r1.get_output(skip=skip)
         r2 = DataInMemory([self.d, self.d])
         out = r2.get_output()
         np.testing.assert_almost_equal(out_with_skip[0], out[0][skip::],
                                        err_msg="The first %s rows of the first file were skipped, but that did not "
                                                "match the rows with skip=0 and sliced by [%s::]" % (skip, skip))
         np.testing.assert_almost_equal(out_with_skip[1], out[1][skip::],
                                        err_msg="The first %s rows of the second file were skipped, but that did not"
                                                " match the rows with skip=0 and sliced by [%s::]" % (skip, skip))
Exemplo n.º 3
0
 def test_stride(self):
     reader = DataInMemory(self.d)
     stride = [1, 2, 3, 4, 5, 6, 7, 10, 11, 21, 23]
     for s in stride:
         output = reader.get_output(stride=s)[0]
         expected = self.d[::s]
         np.testing.assert_allclose(output, expected,
                                    err_msg="not equal for stride=%i" % s)