本文整理汇总了Python中arctic.tickstore.toplevel.TopLevelTickStore.add方法的典型用法代码示例。如果您正苦于以下问题:Python TopLevelTickStore.add方法的具体用法?Python TopLevelTickStore.add怎么用?Python TopLevelTickStore.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arctic.tickstore.toplevel.TopLevelTickStore
的用法示例。
在下文中一共展示了TopLevelTickStore.add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_raise_exception_and_log_an_error_if_an_invalid_library_name_is_added
# 需要导入模块: from arctic.tickstore.toplevel import TopLevelTickStore [as 别名]
# 或者: from arctic.tickstore.toplevel.TopLevelTickStore import add [as 别名]
def test_raise_exception_and_log_an_error_if_an_invalid_library_name_is_added():
arctic_lib = MagicMock()
arctic_lib.arctic.__getitem__.side_effect = Exception()
store = TopLevelTickStore(arctic_lib)
with patch("arctic.tickstore.toplevel.logger") as mock_logger:
with pytest.raises(Exception):
store.add(None, "blah")
mock_logger.error.assert_called_once_with("Could not load library")
示例2: test_add_library_to_colllection_if_date_range_is_on_UTC_or_naive_day_boundaries
# 需要导入模块: from arctic.tickstore.toplevel import TopLevelTickStore [as 别名]
# 或者: from arctic.tickstore.toplevel.TopLevelTickStore import add [as 别名]
def test_add_library_to_colllection_if_date_range_is_on_UTC_or_naive_day_boundaries(start, end, expected_start, expected_end):
self = create_autospec(TopLevelTickStore, _arctic_lib=MagicMock(), _collection=MagicMock())
self._get_library_metadata.return_value = []
TopLevelTickStore.add(self, DateRange(start=start, end=end), "blah")
self._collection.update_one.assert_called_once_with({'library_name': "blah"},
{'$set':
{'start': expected_start,
'end': expected_end}}, upsert=True)
示例3: test_raise_exception_if_date_range_overlaps
# 需要导入模块: from arctic.tickstore.toplevel import TopLevelTickStore [as 别名]
# 或者: from arctic.tickstore.toplevel.TopLevelTickStore import add [as 别名]
def test_raise_exception_if_date_range_overlaps():
self = create_autospec(TopLevelTickStore, _arctic_lib=MagicMock())
self._get_library_metadata.return_value = [TickStoreLibrary("lib1", None)]
with pytest.raises(OverlappingDataException) as e:
TopLevelTickStore.add(self, DateRange(start=dt(2010, 1, 1), end=dt(2011, 1, 1, 23, 59, 59, 999000)), "blah")
assert "There are libraries that overlap with the date range:" in str(e)
示例4: test_raise_error_add_library_is_called_with_a_date_range_not_on_day_boundaries
# 需要导入模块: from arctic.tickstore.toplevel import TopLevelTickStore [as 别名]
# 或者: from arctic.tickstore.toplevel.TopLevelTickStore import add [as 别名]
def test_raise_error_add_library_is_called_with_a_date_range_not_on_day_boundaries(start, end):
with pytest.raises(AssertionError) as e:
self = create_autospec(TopLevelTickStore, _arctic_lib=MagicMock(), _collection=MagicMock())
self._get_library_metadata.return_value = []
TopLevelTickStore.add(self, DateRange(start=start, end=end), "blah")
assert "Date range should fall on UTC day boundaries" in str(e)