當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。