本文整理汇总了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'], [])
示例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'], [])