當前位置: 首頁>>代碼示例>>Python>>正文


Python RecommenderAgent._calc_profile_id方法代碼示例

本文整理匯總了Python中softwarecenter.backend.recagent.RecommenderAgent._calc_profile_id方法的典型用法代碼示例。如果您正苦於以下問題:Python RecommenderAgent._calc_profile_id方法的具體用法?Python RecommenderAgent._calc_profile_id怎麽用?Python RecommenderAgent._calc_profile_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在softwarecenter.backend.recagent.RecommenderAgent的用法示例。


在下文中一共展示了RecommenderAgent._calc_profile_id方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_mocked_recagent_post_submit_profile

# 需要導入模塊: from softwarecenter.backend.recagent import RecommenderAgent [as 別名]
# 或者: from softwarecenter.backend.recagent.RecommenderAgent import _calc_profile_id [as 別名]
 def test_mocked_recagent_post_submit_profile(self, mock_spawn_helper_run):
     recommender_agent = RecommenderAgent()
     recommender_agent._calc_profile_id = lambda profile: "i-am-random"
     db = get_test_db()
     recommender_agent.post_submit_profile(db)
     args, kwargs =  mock_spawn_helper_run.call_args
     # ensure we have packages in the package list and the
     # kwargs have the names we expect
     self.assertNotEqual(kwargs['data'][0]['package_list'], [])
開發者ID:pombredanne,項目名稱:shop,代碼行數:11,代碼來源:test_recagent.py

示例2: test_mocked_recagent_post_submit_profile

# 需要導入模塊: from softwarecenter.backend.recagent import RecommenderAgent [as 別名]
# 或者: from softwarecenter.backend.recagent.RecommenderAgent import _calc_profile_id [as 別名]
 def test_mocked_recagent_post_submit_profile(self, mock_spawn_helper_run):
     def _patched_on_submit_profile_data(*args, **kwargs):
         piston_submit_profile = {}
         recommender_agent.emit("submit-profile-finished", 
                                piston_submit_profile)
     mock_spawn_helper_run.side_effect = _patched_on_submit_profile_data
     recommender_agent = RecommenderAgent()
     recommender_agent.connect("submit-profile-finished", self.on_query_done)
     recommender_agent.connect("error", self.on_query_error)
     recommender_agent._calc_profile_id = lambda profile: "i-am-random"
     db = get_test_db()
     recommender_agent.post_submit_profile(db)
     self.assertFalse(self.error)
     args, kwargs =  mock_spawn_helper_run.call_args
     self.assertNotEqual(kwargs['data'][0]['package_list'], [])
開發者ID:feiying,項目名稱:AppStream,代碼行數:17,代碼來源:test_recagent.py


注:本文中的softwarecenter.backend.recagent.RecommenderAgent._calc_profile_id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。