当前位置: 首页>>代码示例>>Python>>正文


Python TopLevelTickStore.add方法代码示例

本文整理汇总了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")
开发者ID:rsheftel,项目名称:arctic,代码行数:10,代码来源:test_toplevel.py

示例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)
开发者ID:JianfengYu,项目名称:arctic,代码行数:10,代码来源:test_toplevel.py

示例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)
开发者ID:rsheftel,项目名称:arctic,代码行数:8,代码来源:test_toplevel.py

示例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)
开发者ID:rsheftel,项目名称:arctic,代码行数:8,代码来源:test_toplevel.py


注:本文中的arctic.tickstore.toplevel.TopLevelTickStore.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。