Exemple #1
0
    def test_set_get(self):
        x = helper.sample_minutes()

        symbol = 'TS123456'
        self.mstore[symbol] = x
        y = self.mstore[symbol]
        np.testing.assert_array_equal(y, x)
Exemple #2
0
    def test_set_get(self):
        x = helper.sample_minutes()

        symbol = "TS123456"
        self.mstore[symbol] = x
        y = self.mstore[symbol]
        np.testing.assert_array_equal(y, x)
Exemple #3
0
    def test_reopen(self):
        x = helper.sample_minutes()

        symbol = 'TS123456'
        self.mstore[symbol] = x

        # closed
        self.store.close()
        self.assertRaises(AssertionError, self.mstore.get, symbol)

        # reopen
        store = DictStore.open(self.filename)
        mstore = MinuteSnapshotCache(store, self.date)

        # testing reopen data
        y = mstore[symbol]
        np.testing.assert_array_equal(y, x)
Exemple #4
0
    def test_reopen(self):
        x = helper.sample_minutes()

        symbol = "TS123456"
        self.mstore[symbol] = x

        # closed
        self.store.close()
        self.assertRaises(AssertionError, self.mstore.get, symbol)

        # reopen
        store = DictStore.open(self.filename)
        mstore = MinuteSnapshotCache(store, self.date)

        # testing reopen data
        y = mstore[symbol]
        np.testing.assert_array_equal(y, x)
Exemple #5
0
    def test_rotate(self):
        x = helper.sample_minutes()

        symbol = 'TS123456'
        self.mstore[symbol] = x

        dbm = Manager(helper.datadir, SH())
        tostore = dbm._minutestore_at(self.date, memory=False)

        # rewrite
        self.mstore.rotate(tostore)

        # cache cleaned after rotate
        self.assertRaises(KeyError, self.mstore.get, symbol)

        # testing persistent data
        y = tostore[symbol]
        np.testing.assert_array_equal(y, x)

        # reopen
        mstore = MinuteSnapshotCache(self.store, self.date)

        # testing reopen data
        self.assertRaises(KeyError, mstore.get, symbol)
Exemple #6
0
    def test_rotate(self):
        x = helper.sample_minutes()

        symbol = "TS123456"
        self.mstore[symbol] = x

        dbm = Manager(helper.datadir, SH())
        tostore = dbm._minutestore_at(self.date, memory=False)

        # rewrite
        self.mstore.rotate(tostore)

        # cache cleaned after rotate
        self.assertRaises(KeyError, self.mstore.get, symbol)

        # testing persistent data
        y = tostore[symbol]
        np.testing.assert_array_equal(y, x)

        # reopen
        mstore = MinuteSnapshotCache(self.store, self.date)

        # testing reopen data
        self.assertRaises(KeyError, mstore.get, symbol)