def test_fitb_1(selenium_utils_user_1, runestone_db): db = runestone_db def fitb_check_common_fields(index, div_id): answer, correct, percent = check_common_fields( selenium_utils_user_1, db, db.fitb_answers.div_id == div_id, index, div_id, ) return json.loads(answer), correct, percent test_fitb.test_fitb1(selenium_utils_user_1) assert fitb_check_common_fields(0, "test_fitb_string") == (["", ""], False, 0) test_fitb.test_fitb2(selenium_utils_user_1) assert fitb_check_common_fields(1, "test_fitb_string") == (["red", ""], False, 0.5) test_fitb.test_fitb3(selenium_utils_user_1) assert fitb_check_common_fields(2, "test_fitb_string") == (["red", "away"], True, 1) test_fitb.test_fitb4(selenium_utils_user_1) assert fitb_check_common_fields(3, "test_fitb_string") == (["red", "away"], True, 1) test_fitb.test_fitboneblank_too_low(selenium_utils_user_1) assert fitb_check_common_fields(0, "test_fitb_number") == ([" 6"], False, 0) test_fitb.test_fitboneblank_wildcard(selenium_utils_user_1) assert fitb_check_common_fields(1, "test_fitb_number") == (["I give up"], False, 0) test_fitb.test_fitbfillrange(selenium_utils_user_1) assert fitb_check_common_fields(2, "test_fitb_number") == ([" 6.28 "], True, 1) test_fitb.test_fitbregex(selenium_utils_user_1) assert fitb_check_common_fields(0, "test_fitb_regex_1") == ( [" maire ", "LITTLE", "2"], True, 1, ) test_fitb.test_regexescapes1(selenium_utils_user_1) assert fitb_check_common_fields(0, "test_fitb_regex_2") == ( [r"C:\windows\system"], True, 1, ) test_fitb.test_regexescapes2(selenium_utils_user_1) assert fitb_check_common_fields(0, "test_fitb_regex_3") == (["[]"], True, 1)
async def test_fitb_1(selenium_utils_user_1, bookserver_session): async def fitb_check_common_fields(index, div_id): answer, correct, percent = await check_common_fields( selenium_utils_user_1, bookserver_session, select(FitbAnswers).where(FitbAnswers.div_id == div_id), index, div_id, ) return json.loads(answer), correct, percent test_fitb.test_fitb1(selenium_utils_user_1) assert await fitb_check_common_fields(0, "test_fitb_string") == (["", ""], False, 0) test_fitb.test_fitb2(selenium_utils_user_1) assert await fitb_check_common_fields(1, "test_fitb_string") == ( ["red", ""], False, 0.5, ) test_fitb.test_fitb3(selenium_utils_user_1) assert await fitb_check_common_fields(2, "test_fitb_string") == ( ["red", "away"], True, 1, ) test_fitb.test_fitb4(selenium_utils_user_1) assert await fitb_check_common_fields(3, "test_fitb_string") == ( ["red", "away"], True, 1, ) test_fitb.test_fitboneblank_too_low(selenium_utils_user_1) assert await fitb_check_common_fields(0, "test_fitb_number") == ([" 6"], False, 0) test_fitb.test_fitboneblank_wildcard(selenium_utils_user_1) assert await fitb_check_common_fields(1, "test_fitb_number") == ( ["I give up"], False, 0, ) test_fitb.test_fitbfillrange(selenium_utils_user_1) assert await fitb_check_common_fields(2, "test_fitb_number") == ( [" 6.28 "], True, 1, ) test_fitb.test_fitbregex(selenium_utils_user_1) assert await fitb_check_common_fields(0, "test_fitb_regex_1") == ( [" maire ", "LITTLE", "2"], True, 1, ) test_fitb.test_regexescapes1(selenium_utils_user_1) assert await fitb_check_common_fields(0, "test_fitb_regex_2") == ( [r"C:\windows\system"], True, 1, ) test_fitb.test_regexescapes2(selenium_utils_user_1) assert await fitb_check_common_fields(0, "test_fitb_regex_3") == (["[]"], True, 1)