def setUp(self): self.db_conn = sqlite3.connect(':memory:') directory = os.path.join(path, 'video', 'image_sequence') self.v = mr.ImageSequence(directory) self.PARAMS = (11, 3000) with NamedTemporaryFile() as temp: self.expected = mr.batch(self.v[[0, 1]], *self.PARAMS, meta=temp.name)
def test_HDFStore(self): STORE_NAME = 'temp_for_testing.h5' if os.path.isfile(STORE_NAME): os.remove(STORE_NAME) try: store = pd.HDFStore(STORE_NAME) except: nose.SkipTest('Cannot make an HDF5 file. Skipping') else: with NamedTemporaryFile() as temp: f = mr.batch(self.v[[0, 1]], *self.PARAMS, store=store, table='features', meta=temp.name) assert_frame_equal(f.reset_index(drop=True), self.expected.reset_index(drop=True)) os.remove(STORE_NAME)
def test_sqlite(self): with NamedTemporaryFile() as temp: f = mr.batch(self.v[[0, 1]], *self.PARAMS, conn=self.db_conn, sql_flavor='sqlite', table='features', meta=temp.name) assert_frame_equal(f, self.expected)