本文整理匯總了Python中arctic.tickstore.toplevel.TopLevelTickStore.write方法的典型用法代碼示例。如果您正苦於以下問題:Python TopLevelTickStore.write方法的具體用法?Python TopLevelTickStore.write怎麽用?Python TopLevelTickStore.write使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類arctic.tickstore.toplevel.TopLevelTickStore
的用法示例。
在下文中一共展示了TopLevelTickStore.write方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_write_pandas_data_to_right_libraries
# 需要導入模塊: from arctic.tickstore.toplevel import TopLevelTickStore [as 別名]
# 或者: from arctic.tickstore.toplevel.TopLevelTickStore import write [as 別名]
def test_write_pandas_data_to_right_libraries():
self = create_autospec(TopLevelTickStore, _arctic_lib=MagicMock(), _collection=MagicMock())
self._collection.find.return_value = [{'library_name': sentinel.libname1, 'start': sentinel.st1, 'end': sentinel.end1},
{'library_name': sentinel.libname2, 'start': sentinel.st2, 'end': sentinel.end2}]
slice1 = range(2)
slice2 = range(4)
when(self._slice).called_with(sentinel.data, sentinel.st1, sentinel.end1).then(slice1)
when(self._slice).called_with(sentinel.data, sentinel.st2, sentinel.end2).then(slice2)
mock_lib1 = Mock()
mock_lib2 = Mock()
when(self._arctic_lib.arctic.__getitem__).called_with(sentinel.libname1).then(mock_lib1)
when(self._arctic_lib.arctic.__getitem__).called_with(sentinel.libname2).then(mock_lib2)
TopLevelTickStore.write(self, 'blah', sentinel.data)
mock_lib1.write.assert_called_once_with('blah', slice1)
mock_lib2.write.assert_called_once_with('blah', slice2)