function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def test_base_class_convert_html_in_suggestion_change(self): def conversion_fn(): """Temporary function.""" pass with self.assertRaisesRegex( NotImplementedError, 'Subclasses of BaseSuggestion should implement' ' convert_html_in_suggestion_chan...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def setUp(self): super(SuggestionEditStateContentUnitTests, self).setUp() self.signup(self.AUTHOR_EMAIL, 'author') self.author_id = self.get_user_id_from_email(self.AUTHOR_EMAIL) self.signup(self.REVIEWER_EMAIL, 'reviewer') self.reviewer_id = self.get_user_id_from_email(self.REV...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_suggestion_edit_state_content(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionEditStateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_d...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_suggestion_type(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionEditStateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_ver...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_target_id(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionEditStateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_version_a...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_status(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionEditStateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_version_at_s...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_author_id_format(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionEditStateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_ve...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_final_reviewer_id_format(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionEditStateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['t...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_score_category_format(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionEditStateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['targ...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_change(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionEditStateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_version_at_s...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_change_cmd(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionEditStateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_version_...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_language_code_fails_when_language_codes_do_not_match( self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionEditStateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id']...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_populate_old_value_of_change_with_invalid_state(self): self.save_new_default_exploration('exp1', self.author_id) expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionEditStateContent( expected_suggestion_dict['suggestion_id'], ...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_pre_update_validate_change_property_name(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionEditStateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_pre_update_validate_change_new_value(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionEditStateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_get_all_html_content_strings(self): change_dict = { 'cmd': exp_domain.CMD_EDIT_STATE_PROPERTY, 'property_name': exp_domain.STATE_PROPERTY_CONTENT, 'state_name': 'state_1', 'new_value': { 'content_id': 'content', 'html': 'ne...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_get_target_entity_html_strings_returns_expected_strings(self): change_dict = { 'cmd': exp_domain.CMD_EDIT_STATE_PROPERTY, 'property_name': exp_domain.STATE_PROPERTY_CONTENT, 'state_name': 'state_1', 'new_value': { 'content_id': 'content', ...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def setUp(self): super(SuggestionTranslateContentUnitTests, self).setUp() self.signup(self.AUTHOR_EMAIL, 'author') self.author_id = self.get_user_id_from_email(self.AUTHOR_EMAIL) self.signup(self.REVIEWER_EMAIL, 'reviewer') self.reviewer_id = self.get_user_id_from_email(self.REV...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_pre_update_validate_change_state_name(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionTranslateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dic...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_pre_update_validate_change_content_html(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionTranslateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_d...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_suggestion_add_translation(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionTranslateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_suggestion_type(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionTranslateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_ver...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_target_id(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionTranslateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_version_a...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_status(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionTranslateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_version_at_s...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_author_id_format(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionTranslateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_ve...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_final_reviewer_id_format(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionTranslateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['t...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_score_category_format(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionTranslateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['targ...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_change(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionTranslateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_version_at_s...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_change_cmd(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionTranslateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_version_...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_language_code_fails_when_language_code_is_set_to_none( self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionTranslateContent( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_pre_accept_validate_state_name(self): self.save_new_default_exploration('exp1', self.author_id) expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionTranslateContent( expected_suggestion_dict['suggestion_id'], expected_sugges...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_accept_suggestion_with_set_of_string_adds_translation(self): self.save_new_default_exploration('exp1', self.author_id) exploration = exp_fetchers.get_exploration_by_id('exp1') self.assertEqual(exploration.get_translation_counts(), {}) suggestion = suggestion_registry.SuggestionT...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_get_all_html_content_strings(self): suggestion = suggestion_registry.SuggestionTranslateContent( self.suggestion_dict['suggestion_id'], self.suggestion_dict['target_id'], self.suggestion_dict['target_version_at_submission'], self.suggestion_dict['status']...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_get_target_entity_html_strings_returns_expected_strings(self): suggestion = suggestion_registry.SuggestionTranslateContent( self.suggestion_dict['suggestion_id'], self.suggestion_dict['target_id'], self.suggestion_dict['target_version_at_submission'], sel...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def setUp(self): super(SuggestionAddQuestionTest, self).setUp() self.signup(self.AUTHOR_EMAIL, 'author') self.author_id = self.get_user_id_from_email(self.AUTHOR_EMAIL) self.signup(self.REVIEWER_EMAIL, 'reviewer') self.reviewer_id = self.get_user_id_from_email(self.REVIEWER_EMAI...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_suggestion_edit_state_content(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionAddQuestion( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_score_type(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionAddQuestion( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_version_at_s...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_change_cmd(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionAddQuestion( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_version_at_s...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_change_question_dict(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionAddQuestion( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_ve...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_change_skill_difficulty_none(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionAddQuestion( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['ta...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_pre_accept_validate_change_skill_id(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionAddQuestion( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['tar...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_get_change_list_for_accepting_suggestion(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionAddQuestion( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_cannot_accept_suggestion_with_invalid_skill_id(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionAddQuestion( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestio...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_pre_update_validate_change_skill_id(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionAddQuestion( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['tar...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_pre_update_validate_accepts_a_change_in_skill_difficulty_only( self): change = { 'cmd': question_domain.CMD_CREATE_NEW_FULLY_SPECIFIED_QUESTION, 'question_dict': { 'question_state_data': self._create_valid_question_data( 'default_s...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_author_id(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionAddQuestion( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_version_at_sub...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_final_reviewer_id(self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionAddQuestion( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], expected_suggestion_dict['target_versio...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_language_code_fails_when_language_codes_do_not_match( self): expected_suggestion_dict = self.suggestion_dict suggestion = suggestion_registry.SuggestionAddQuestion( expected_suggestion_dict['suggestion_id'], expected_suggestion_dict['target_id'], ...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_get_all_html_conztent_strings(self): suggestion = suggestion_registry.SuggestionAddQuestion( self.suggestion_dict['suggestion_id'], self.suggestion_dict['target_id'], self.suggestion_dict['target_version_at_submission'], self.suggestion_dict['status'], se...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_accept_suggestion_with_images(self): html_content = ( '<p>Value</p><oppia-noninteractive-math math_content-with-value=' '"{&amp;quot;raw_latex&amp;quot;: &amp;quot;+,-,-,+&amp;quot;, &' 'amp;quot;svg_filename&amp;quot;: &amp;quot;img.svg&amp;quot;}">' '</...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_contructor_updates_state_shema_in_change_cmd(self): score_category = ( suggestion_models.SCORE_TYPE_QUESTION + suggestion_models.SCORE_CATEGORY_DELIMITER + 'skill_id') change = { 'cmd': ( question_domain .CMD_CREATE_NEW_FULLY_S...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def __init__(self): # pylint: disable=super-init-not-called pass
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def setUp(self): super(BaseVoiceoverApplicationUnitTests, self).setUp() self.base_voiceover_application = MockInvalidVoiceoverApplication()
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_base_class_accept_raises_error(self): with self.assertRaisesRegex( NotImplementedError, 'Subclasses of BaseVoiceoverApplication should implement accept.'): self.base_voiceover_application.accept()
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def setUp(self): super(ExplorationVoiceoverApplicationUnitTest, self).setUp() self.signup('author@example.com', 'author') self.author_id = self.get_user_id_from_email('author@example.com') self.signup('reviewer@example.com', 'reviewer') self.reviewer_id = self.get_user_id_from_e...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validation_with_invalid_target_id_raise_exception(self): self.voiceover_application.validate() self.voiceover_application.target_id = 123 with self.assertRaisesRegex( utils.ValidationError, 'Expected target_id to be a string' ): self.voiceover_applicatio...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validation_with_invalid_author_id_raise_exception(self): self.voiceover_application.validate() self.voiceover_application.author_id = 123 with self.assertRaisesRegex( utils.ValidationError, 'Expected author_id to be a string' ): self.voiceover_applicatio...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validation_for_handled_application_with_invalid_final_review(self): self.assertEqual( self.voiceover_application.status, suggestion_models.STATUS_IN_REVIEW) self.assertEqual(self.voiceover_application.final_reviewer_id, None) self.voiceover_application.validate()...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validation_for_accepted_application_with_message(self): self.assertEqual( self.voiceover_application.status, suggestion_models.STATUS_IN_REVIEW) self.assertEqual(self.voiceover_application.rejection_message, None) self.voiceover_application.validate() se...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validation_with_invalid_language_code_raise_exception(self): self.assertEqual(self.voiceover_application.language_code, 'en') self.voiceover_application.validate() self.voiceover_application.language_code = 'invalid language' with self.assertRaisesRegex( utils.Valid...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validation_with_invalid_content_type_raise_exception(self): self.assertEqual(self.voiceover_application.content, '<p>Content</p>') self.voiceover_application.validate() self.voiceover_application.content = 1 with self.assertRaisesRegex( utils.ValidationError, 'Expec...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_is_handled_property_returns_correct_value(self): self.assertFalse(self.voiceover_application.is_handled) self.voiceover_application.accept(self.reviewer_id) self.assertTrue(self.voiceover_application.is_handled)
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_reject_voiceover_application(self): self.assertEqual(self.voiceover_application.final_reviewer_id, None) self.assertEqual(self.voiceover_application.status, 'review') self.voiceover_application.reject(self.reviewer_id, 'rejection message') self.assertEqual( self.vo...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def _assert_community_contribution_stats_is_in_default_state(self): """Checks if the community contribution stats is in its default state. """ community_contribution_stats = ( suggestion_services.get_community_contribution_stats() ) self.assertEqual( ...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_set_translation_reviewer_count_for_lang_code_updates_empty_dict( self): community_contribution_stats = ( suggestion_services.get_community_contribution_stats() ) self._assert_community_contribution_stats_is_in_default_state() ( community_cont...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_set_translation_reviewer_count_for_lang_code_adds_new_lang_key( self): community_contribution_stats = ( suggestion_services.get_community_contribution_stats() ) self._assert_community_contribution_stats_is_in_default_state() ( community_contri...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_set_translation_suggestion_count_for_lang_code_updates_count_value( self): community_contribution_stats = ( suggestion_services.get_community_contribution_stats() ) self._assert_community_contribution_stats_is_in_default_state() ( community_co...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_get_translation_language_codes_that_need_reviewers_for_one_lang( self): stats = suggestion_services.get_community_contribution_stats() stats.set_translation_suggestion_count_for_language_code( self.sample_language_code, 1) language_codes_that_need_reviewers = ( ...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_get_translation_language_codes_that_need_reviewers_for_no_lang( self): stats = suggestion_services.get_community_contribution_stats() language_codes_that_need_reviewers = ( stats.get_translation_language_codes_that_need_reviewers() ) self.assertEqual( ...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_translation_reviewers_are_needed_if_num_suggestions_past_max(self): stats = suggestion_services.get_community_contribution_stats() stats.set_translation_suggestion_count_for_language_code( self.sample_language_code, 2) stats.set_translation_reviewer_count_for_language_code( ...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_translation_reviewers_not_needed_if_num_suggestions_less_max(self): stats = suggestion_services.get_community_contribution_stats() stats.set_translation_suggestion_count_for_language_code( self.sample_language_code, 1) stats.set_translation_reviewer_count_for_language_code( ...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_translation_reviewers_not_needed_if_no_reviewers_no_sugestions( self): stats = suggestion_services.get_community_contribution_stats() self._assert_community_contribution_stats_is_in_default_state() self.assertFalse( stats.are_translation_reviewers_needed_for_lan...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_question_reviewers_are_needed_if_num_suggestions_past_max(self): stats = suggestion_services.get_community_contribution_stats() stats.question_suggestion_count = 2 stats.question_reviewer_count = 1 config_services.set_property( 'committer_id', 'max_number_of_suggesti...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_question_reviewers_not_needed_if_num_suggestions_less_max(self): stats = suggestion_services.get_community_contribution_stats() stats.question_suggestion_count = 1 stats.question_reviewer_count = 2 config_services.set_property( 'committer_id', 'max_number_of_suggesti...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_translation_reviewer_counts_fails_for_negative_counts( self): community_contribution_stats = ( suggestion_services.get_community_contribution_stats() ) ( community_contribution_stats .set_translation_reviewer_count_for_language_co...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_question_reviewer_count_fails_for_negative_count(self): community_contribution_stats = ( suggestion_services.get_community_contribution_stats() ) community_contribution_stats.question_reviewer_count = ( self.negative_count ) with self.as...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_translation_reviewer_counts_fails_for_non_integer_counts( self): community_contribution_stats = ( suggestion_services.get_community_contribution_stats() ) ( community_contribution_stats .set_translation_reviewer_count_for_language...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_question_reviewer_count_fails_for_non_integer_count( self): community_contribution_stats = ( suggestion_services.get_community_contribution_stats() ) community_contribution_stats.question_reviewer_count = ( self.non_integer_count ) ...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_validate_translation_reviewer_counts_fails_for_invalid_lang_code( self): community_contribution_stats = ( suggestion_services.get_community_contribution_stats() ) ( community_contribution_stats .set_translation_reviewer_count_for_language_...
oppia/oppia
[ 4927, 2897, 4927, 1181, 1439511374 ]
def test_parse_sections(): simple_mariofile_sections = dict(mariofile.parse_sections(SIMPLE_MARIOFILE.splitlines(True))) assert len(simple_mariofile_sections) == 3 complex_mariofile_sections = dict(mariofile.parse_sections(COMPLEX_MARIOFILE.splitlines(True))) assert len(complex_mariofile_sections) == 2 ...
bopen/mariobros
[ 15, 4, 15, 1, 1430924766 ]
def test_statements(): with pytest.raises(mariofile.ConfigurationFileError): mariofile.parse_section_body(CRASH_MARIOFILE_1.splitlines()) with pytest.raises(mariofile.ConfigurationFileError): mariofile.parse_section_body(CRASH_MARIOFILE_2.splitlines())
bopen/mariobros
[ 15, 4, 15, 1, 1430924766 ]
def test_parse_statements(): parsed_statement = mariofile.parse_statements(STRING_PARSE_STATEMENTS.splitlines()) assert '\n'.join(parsed_statement) == "statement\nstatement con commento"
bopen/mariobros
[ 15, 4, 15, 1, 1430924766 ]
def test_parse_section_body(): output_section = { 'action_template': ' task', 'sources_repls': 'source', 'variable': '6', 'target_pattern': 'target', } assert mariofile.parse_section_body(SECTION.splitlines(True)) == output_section with pytest.raises(mariofile.Configur...
bopen/mariobros
[ 15, 4, 15, 1, 1430924766 ]
def test_parse_include(): filepaths, current_line = mariofile.parse_include(INCLUDE_FILE.splitlines(True)) assert filepaths == ['prova.ini', 'altrofile.ini'] assert current_line == 4 filepaths, current_line = mariofile.parse_include(INCLUDE_UNIQUE_FILE.splitlines(True)) assert filepaths == ['prova.i...
bopen/mariobros
[ 15, 4, 15, 1, 1430924766 ]
def check_permissions(self, perm_db, perm_set, path): invalid = [] for p in perm_set: if ':' not in p: invalid.append(p) continue s, a = p.split(':', 1) if s not in perm_db: invalid.append(p) continue ...
kapilt/cloud-custodian
[ 2, 2, 2, 8, 1461493242 ]
def setUpTestData(cls): cls.setup_users() cls.setup_categories() cls.setup_authors() cls.setup_languages() cls.setup_books() cls.setup_added_books() cls.setup_book_rating() cls.setup_book_comment() cls.setup_post_messages() cls.setup_suppor...
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]
def setup_users(cls): client = Client() cls.anonymous_user = auth.get_user(client) cls.user1 = User.objects.create_user('user1', 'user1@user1.com', 'testpassword1') cls.user2 = User.objects.create_user('user2', 'user2@user2.com', 'testpassword2') cls.user3 = User.objects.create_...
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]
def setup_categories(cls): cls.category1 = Category.objects.create(category_name='category1') cls.category2 = Category.objects.create(category_name='category2')
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]
def setup_authors(cls): cls.author1 = Author.objects.create(author_name='Best Author 1') cls.author2 = Author.objects.create(author_name='trueAuthorNew') cls.author3 = Author.objects.create(author_name='zlast author') cls.author4 = Author.objects.create(author_name='<AuthorSpecialSymbols...
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]
def setup_languages(cls): cls.language_en = Language.objects.create(language='English') cls.language_ru = Language.objects.create(language='Russian')
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]
def setup_books(cls): test_book_path = os.path.join(TEST_DATA_DIR, 'test_book.pdf') test_book_image_path = os.path.join(TEST_DATA_DIR, 'test_book_image.png') books_setup = [ { 'name': 'First Book', 'author': cls.author1, 'category': cl...
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]
def setup_added_books(cls): AddedBook.objects.create(id_user=cls.the_user1, id_book=Book.objects.get(book_name='Third Book')) AddedBook.objects.create(id_user=cls.the_user1, id_book=Book.objects.get(book_name='Sixth Book')) AddedBook.objects.create(id_user=cls.the_user1, id_book=Book.objects.get...
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]
def setup_book_rating(cls): BookRating.objects.create(id_book=Book.objects.get(book_name='Third Book'), id_user=cls.the_user1, rating=10) BookRating.objects.create(id_book=Book.objects.get(book_name='Third Book'), id_user=cls.the_user2, rating=5) BookRating.objects.create(id_book=Book.objects.ge...
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]
def setup_book_comment(cls): second_book = Book.objects.get(book_name='Second Book') third_book = Book.objects.get(book_name='Third Book') fourth_book = Book.objects.get(book_name='Fourth Book') BookComment.objects.create(id_book=second_book, id_user=cls.the_user1, text='Test book 2 use...
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]
def setup_post_messages(cls): Post.objects.create(user=cls.the_user1, heading='post 1', text='Posted test text 1') Post.objects.create(user=cls.the_user1, heading='post 2', text='Posted test text 2') Post.objects.create(user=cls.the_user2, heading='post 3', text='Posted test text 3')
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]
def setup_support_messages(cls): SupportMessage.objects.create(email='testemail1@mail.co', text='Test text1') SupportMessage.objects.create(email='testemail1@mail.co', text='Test text2') SupportMessage.objects.create(email='test_email22@mail.co', text='Test text3') SupportMessage.objects...
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]
def test_the_user_str(self): self.assertEqual(str(self.the_user1), 'user1') self.assertEqual(str(self.the_user2), 'user2')
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]
def test_creating_the_user_objects(self): """ Must create 'app.models.TheUser' instance after django User instance was created. """ self.assertEqual(User.objects.all().count(), 6) self.assertEqual(User.objects.all().count(), TheUser.objects.all().count()) self.assertNotEq...
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]
def test_the_user_get_api_reminders(self): reminders = self.the_user1.get_api_reminders() reminders_keys_correct = ['vk', 'fb_group', 'fb_page', 'twitter', 'disabled_all', 'app_rate'] self.assertTrue(isinstance(reminders, dict)) self.assertEqual(sorted(list(reminders.keys())), sorted(re...
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]
def test_the_user_get_web_reminders(self): reminders = self.the_user1.get_web_reminders() reminders_keys_correct = ['vk', 'fb_group', 'fb_page', 'twitter', 'disabled_all', 'app_download'] self.assertTrue(isinstance(reminders, dict)) self.assertEqual(sorted(list(reminders.keys())), sorte...
OlegKlimenko/Plamber
[ 9, 1, 9, 28, 1487368387 ]