本文整理匯總了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