本文整理汇总了Python中okcupyd.User.search方法的典型用法代码示例。如果您正苦于以下问题:Python User.search方法的具体用法?Python User.search怎么用?Python User.search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类okcupyd.User
的用法示例。
在下文中一共展示了User.search方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_question_filter_with_custom_answers
# 需要导入模块: from okcupyd import User [as 别名]
# 或者: from okcupyd.User import search [as 别名]
def test_question_filter_with_custom_answers():
user = User()
user_question = user.questions.somewhat_important[1]
unacceptable_answers = [answer_option.id
for answer_option in user_question.answer_options
if not answer_option.is_match]
for profile in user.search(question=user_question.id,
question_answers=unacceptable_answers)[:5]:
question = profile.find_question(user_question.id)
assert not question.their_answer_matches
示例2: test_search_populates_upfront
# 需要导入模块: from okcupyd import User [as 别名]
# 或者: from okcupyd.User import search [as 别名]
def test_search_populates_upfront():
user = User()
search_fetchable = user.search()
for profile in search_fetchable[:4]:
profile_session = profile._session
with mock.patch.object(profile, '_session') as mock_session:
mock_session.okc_get.side_effect = profile_session.okc_get
assert profile.id > 0
assert mock_session.okc_get.call_count == 0
profile.essays.self_summary
assert mock_session.okc_get.call_count == 1
示例3: test_question_count_filter
# 需要导入模块: from okcupyd import User [as 别名]
# 或者: from okcupyd.User import search [as 别名]
def test_question_count_filter():
user = User()
for profile in user.search(question_count_min=250)[:5]:
assert profile.questions[249]
示例4: test_question_filter
# 需要导入模块: from okcupyd import User [as 别名]
# 或者: from okcupyd.User import search [as 别名]
def test_question_filter():
user = User()
user_question = user.questions.somewhat_important[0]
for profile in user.search(question=user_question)[:5]:
question = profile.find_question(user_question.id)
assert question.their_answer_matches