diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4334bd292..d847a302b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,7 @@ jobs: - name: "Ruff" run: | poetry run ruff check + - uses: crate-ci/typos@master - name: "Mypy" run: poetry run mypy relate course - name: "Safety" diff --git a/accounts/utils.py b/accounts/utils.py index 44a1fa741..ce7331e45 100644 --- a/accounts/utils.py +++ b/accounts/utils.py @@ -157,7 +157,7 @@ def check_email_appellation_priority_list(self): priority_list = [] not_supported_appels = [] - # filter out not allowd appellations in customized list + # filter out not allowed appellations in customized list for appell in custom_email_appellation_priority_list: if appell in DEFAULT_EMAIL_APPELLATION_PRIORITY_LIST: priority_list.append(appell) diff --git a/course/constants.py b/course/constants.py index 393511e03..0cde3b064 100644 --- a/course/constants.py +++ b/course/constants.py @@ -215,7 +215,7 @@ class participation_permission: # noqa "Recalculate flow session grade")), (participation_permission.batch_recalculate_flow_session_grade, pgettext_lazy("Participation permission", - "Batch-recalculate flow sesssion grades")), + "Batch-recalculate flow session grades")), (participation_permission.reopen_flow_session, pgettext_lazy("Participation permission", "Reopen flow session")), diff --git a/course/enrollment.py b/course/enrollment.py index a5cd84896..5411678c8 100644 --- a/course/enrollment.py +++ b/course/enrollment.py @@ -289,7 +289,7 @@ def email_suffix_matches(email: str, suffix: str) -> bool: msg.send() messages.add_message(request, messages.INFO, - _("Enrollment request sent. You will receive notifcation " + _("Enrollment request sent. You will receive notification " "by email once your request has been acted upon.")) else: handle_enrollment_request(course, user, participation_status.active, diff --git a/course/grades.py b/course/grades.py index 9726f1480..0027296fb 100644 --- a/course/grades.py +++ b/course/grades.py @@ -366,7 +366,7 @@ def __init__(self, whether the instance is created by a flow-session-related opportunity. :param grades: optional, a :class:`list:` of float or None, representing the percentage grades of each page in the flow session. - :param has_finished_session: a :class:`bool:`, respresent whether + :param has_finished_session: a :class:`bool:`, represent whether the related participation has finished a flow-session, if the opportunity is a flow-session related one. This is used to correctly order flow state, if the participation has at least one finished flow session, the in-progress @@ -1409,9 +1409,9 @@ def import_grades(pctx): else: if total_count != len(grade_changes): messages.add_message(pctx.request, messages.INFO, - _("%(total)d grades found, %(unchaged)d unchanged.") + _("%(total)d grades found, %(unchanged)d unchanged.") % {"total": total_count, - "unchaged": total_count - len(grade_changes)}) + "unchanged": total_count - len(grade_changes)}) from django.template.loader import render_to_string diff --git a/course/models.py b/course/models.py index 9f974e270..506926a87 100644 --- a/course/models.py +++ b/course/models.py @@ -1577,7 +1577,7 @@ class GradingOpportunity(models.Model): aggregation_strategy = models.CharField(max_length=20, choices=GRADE_AGGREGATION_STRATEGY_CHOICES, - # Translators: strategy on how the grading of mutiple sessioins + # Translators: strategy on how the grading of multiple sessioins # are aggregated. verbose_name=_("Aggregation strategy")) diff --git a/course/page/base.py b/course/page/base.py index 69b727838..46d03f243 100644 --- a/course/page/base.py +++ b/course/page/base.py @@ -145,7 +145,7 @@ def __init__( self.may_change_answer = may_change_answer def __bool__(self): - # This is for compatiblity: page_behavior used to be a bool argument + # This is for compatibility: page_behavior used to be a bool argument # 'answer_is_final'. return not self.may_change_answer @@ -479,7 +479,7 @@ def initialize_page_data(self, page_context: PageContext) -> dict: data = self.make_page_data() if data: from warnings import warn - warn(_("%s is using the make_page_data compatiblity hook, which " + warn(_("%s is using the make_page_data compatibility hook, which " "is deprecated.") % type(self).__name__, DeprecationWarning) @@ -590,7 +590,7 @@ def process_form_post( """ from warnings import warn - warn(_("%s is using the post_form compatiblity hook, which " + warn(_("%s is using the post_form compatibility hook, which " "is deprecated.") % type(self).__name__, DeprecationWarning) @@ -662,7 +662,7 @@ def update_grade_data_from_grading_form_v2( from warnings import warn warn(_("%s is using the update_grade_data_from_grading_form " - "compatiblity hook, which " + "compatibility hook, which " "is deprecated.") % type(self).__name__, DeprecationWarning) @@ -753,7 +753,7 @@ def normalized_bytes_answer( to be stuffed in a zip file. :returns: a tuple of ``(file_ext, data)`` where *file_ext* is a suggested - file extension (inlcuding the leading period, if applicable). + file extension (including the leading period, if applicable). May also return *None*. One use case of this function is to work as input for a plagiarism diff --git a/course/page/code.py b/course/page/code.py index 45a5c6e83..fc2d85c59 100644 --- a/course/page/code.py +++ b/course/page/code.py @@ -372,7 +372,7 @@ def is_nuisance_failure(result): if "BadStatusLine" in result["traceback"]: # Occasionally, we fail to send a POST to the container, even after - # the inital ping GET succeeded, for (for now) mysterious reasons. + # the initial ping GET succeeded, for (for now) mysterious reasons. # Just try again. return True @@ -590,11 +590,11 @@ def __init__(self, vctx, location, page_desc, language_mode): if not is_multi_submit: vctx.add_warning(location, _("code question does not explicitly " "allow multiple submission. Either add " - "access_rules/add_permssions/change_answer " + "access_rules/add_permissions/change_answer " "or add 'single_submission: True' to confirm that you intend " "for only a single submission to be allowed. " "While you're at it, consider adding " - "access_rules/add_permssions/see_correctness.")) + "access_rules/add_permissions/see_correctness.")) def required_attrs(self): return ( diff --git a/course/page/inline.py b/course/page/inline.py index dc7673600..6be39750b 100644 --- a/course/page/inline.py +++ b/course/page/inline.py @@ -195,7 +195,7 @@ def get_form_field(self, page_context): # length unit used is "em" DEFAULT_WIDTH = 10 -MINIMUN_WIDTH = 4 +MINIMUM_WIDTH = 4 EM_LEN_DICT = { "em": 1, @@ -308,7 +308,7 @@ def __init__(self, vctx, location, name, answers_desc): self.width = 0 if parsed_length is not None: - self.width = max(MINIMUN_WIDTH, parsed_length) + self.width = max(MINIMUM_WIDTH, parsed_length) else: self.width = DEFAULT_WIDTH @@ -320,7 +320,7 @@ def __init__(self, vctx, location, name, answers_desc): string_concat("%s, ", # Translators: refers to optional # correct answer for checking - # correctness sumbitted by students. + # correctness submitted by students. _("answer"), " %d") % (location, i+1), answer) diff --git a/course/templates/course/flow-page.html b/course/templates/course/flow-page.html index c2a7ee466..6c0787040 100644 --- a/course/templates/course/flow-page.html +++ b/course/templates/course/flow-page.html @@ -71,7 +71,7 @@ relate-bookmarked {% endif %} " - title="{% trans "Boomark this page" %}"> + title="{% trans "Bookmark this page" %}"> {% trans "Past sessions" %} {% blocktrans trimmed %} You're not currently signed in. Access to the resource is restricted, and since the site has no way of knowing who you are, it may have denied - you accesss. + you access. Once you're signed in, navigate back to your course from the home page and retry your last action. diff --git a/course/templatetags/coursetags.py b/course/templatetags/coursetags.py index 21035af7d..015135ce8 100644 --- a/course/templatetags/coursetags.py +++ b/course/templatetags/coursetags.py @@ -45,7 +45,7 @@ def do_get_current_js_lang_name(parser, token): """ This will store the current language in the context, in js lang format. This is different with built-in do_get_current_language, which returns - languange name like "en-us", "zh-hans". This method return lang name + language name like "en-us", "zh-hans". This method return lang name "en-US", "zh-Hans", with the country code capitallized if country code has 2 characters, and capitalize first if country code has more than 2 characters. diff --git a/course/utils.py b/course/utils.py index f60a7723a..a364665f0 100644 --- a/course/utils.py +++ b/course/utils.py @@ -778,7 +778,7 @@ def instantiate_flow_page_with_ctx( # }}} -# {{{ utilties for course-based views +# {{{ utilities for course-based views def course_view(f): def wrapper(request, course_identifier, *args, **kwargs): @@ -1137,12 +1137,12 @@ def will_use_masked_profile_for_email( if not isinstance(recipient_email, list): recipient_email = [recipient_email] from course.models import Participation - recepient_participations = ( + recipient_participations = ( Participation.objects.filter( user__email__in=recipient_email )) from course.constants import participation_permission as pperm - for part in recepient_participations: + for part in recipient_participations: if part.has_permission(pperm.view_participant_masked_profile): return True return False diff --git a/doc/content.rst b/doc/content.rst index 48ccb1256..d9f39606e 100644 --- a/doc/content.rst +++ b/doc/content.rst @@ -138,7 +138,7 @@ export :ref:`markup` to essentially any other markup format under the sun, including LaTeX, HTML, MediaWiki, Microsoft Word, and many more. Further, YAML files are quite easy to read and traverse in most programming languages, -facilitating automated coversion. `This example Python script +facilitating automated conversion. `This example Python script `_ provided as part of RELATE takes a flow and converts it to a paper-based worksheet. To do so, it makes use of `pypandoc @@ -485,7 +485,7 @@ Here's an example: .. attribute:: id - An identifer used as page anchors and for tracking. Not + An identifier used as page anchors and for tracking. Not user-visible otherwise. .. attribute:: rules @@ -565,7 +565,7 @@ Events serve two purposes: * They are (optionally) shown in the class calendar. For example, to create contiguously numbered ``lecture`` events for a -lecture occuring on a Tuesday/Thursday schedule, perform the following +lecture occurring on a Tuesday/Thursday schedule, perform the following sequence of steps: * Create a recurring, weekly event for the Tuesday lectures, with a @@ -648,7 +648,7 @@ by the 'ordinal' of each event. The secondsection, ``events``, can be used to provide a more verbose description for each event that appears below the main calendar. Titles and -colors can also be overriden for each event specifically. +colors can also be overridden for each event specifically. All attributes in each section (as well as the entire calendar information file) are optional. diff --git a/doc/faq.rst b/doc/faq.rst index 040e99750..ef1521d16 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -31,7 +31,7 @@ Getting everything set up - Now you are ready to click that 'Set up new course' button. Fill in the form that pops up. For the 'Git source' field, - use the SSH clone URL provided by your Git host. It shoud look + use the SSH clone URL provided by your Git host. It should look like this:: git@hostingsite.com:yourusername/yourreponame.git @@ -256,7 +256,7 @@ Here's an example page to give you an idea:: I wrote a Yes/No question, but RELATE shows "True/False" instead of "Yes/No"--why on earth would it do that? ------------------------------------------------------------------------------------------------------------ -This is a bit of a misfeature in YAML (which relate uses), wich parses ``No`` as +This is a bit of a misfeature in YAML (which relate uses), which parses ``No`` as a :class:`bool` instead of a literal string. Once that has happened, relate can't recover the original string representation. To avoid that, just put quotes around the ``"No"``. diff --git a/doc/flow.rst b/doc/flow.rst index 59e62ca15..e87eed740 100644 --- a/doc/flow.rst +++ b/doc/flow.rst @@ -657,7 +657,7 @@ The rules for this can be written as follows:: message: | You have marked your session to roll over to 50% credit at the due date. If you would like to have your current answers graded as-is - (and recieve full credit for them), please select 'End session + (and receive full credit for them), please select 'End session and grade'. permissions: [view, submit_answer, end_session, see_correctness, change_answer, set_roll_over_expiration_mode] diff --git a/doc/misc.rst b/doc/misc.rst index 153480435..5f72f6275 100644 --- a/doc/misc.rst +++ b/doc/misc.rst @@ -330,7 +330,7 @@ Next, install Relate and its dependencies:: poetry install -In order to use the ``relate`` comand, you need to activate the virtualenv that +In order to use the ``relate`` command, you need to activate the virtualenv that was created:: source ~/path/to/relate/checkout/.venv/bin/activate diff --git a/local_settings_example.py b/local_settings_example.py index 28ef4802a..756e11053 100644 --- a/local_settings_example.py +++ b/local_settings_example.py @@ -256,7 +256,7 @@ # If set to False, user won't be able to edit institutional ID # after submission. Set to False only when you trust your students -# or you don't want to verfiy insitutional ID they submit. +# or you don't want to verify insitutional ID they submit. RELATE_EDITABLE_INST_ID_BEFORE_VERIFICATION = True # If set to False, these fields will be hidden in the user profile form. @@ -275,7 +275,7 @@ # RELATE's default full_name format is "'%s %s' % (first_name, last_name)", # you can override it by supply a customized method/fuction, with -# "firstname" and "lastname" as its paramaters, and return a string. +# "firstname" and "lastname" as its parameters, and return a string. # For example, you can define it like this: @@ -316,7 +316,7 @@ # When a participation, for example, teaching assistant, has limited access to # students' profile (i.e., has_permission(pperm.view_participant_masked_profile)), # a built-in mask method (which is based on pk of user instances) is used be -# default. The mask method can be overriden by the following a custom method, with +# default. The mask method can be overridden by the following a custom method, with # user as the args. # RELATE_USER_PROFILE_MASK_METHOD = "path.tomy_method @@ -339,7 +339,7 @@ # {{{ extra checks -# This allow user to add customized startup checkes for user-defined modules +# This allow user to add customized startup checks for user-defined modules # using Django's system checks (https://docs.djangoproject.com/en/dev/ref/checks/) # For example, define a `my_check_func in `my_module` with # @@ -529,7 +529,7 @@ } SAML_CONFIG = { - # full path to the xmlsec1 binary programm + # full path to the xmlsec1 binary program "xmlsec_binary": "/usr/bin/xmlsec1", # your entity id, usually your subdomain plus the url to the metadata view diff --git a/pyproject.toml b/pyproject.toml index 6f87855ee..3592003f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -264,4 +264,30 @@ markers = [ "postgres: mark test as postgres specific", ] +[tool.typos.default] +extend-ignore-re = [ + "(?Rm)^.*(#|//)\\s*spellchecker:\\s*disable-line" +] + +[tool.typos.default.extend-words] +# opps as in 'grading opportunities' +opps = "opps" +# fre, short for flow rule exception +fre = "fre" +# short for 'stipulation' +stip = "stip" +# as in documen.tician.de +documen = "documen" +# like sur_name in SAML +sur = "sur" + +[tool.typos.files] +extend-exclude = [ +"locale/**/*.po", +# migrations reflect the past, don't attempt to alter them. +"*/migrations/**/*.py", +# not ours +"saml-config/**/*.py", +] + # vim: foldmethod=marker diff --git a/relate/settings.py b/relate/settings.py index ef40f7010..ded26d1c2 100644 --- a/relate/settings.py +++ b/relate/settings.py @@ -215,7 +215,7 @@ # {{{ database -# default, likely overriden by local_settings.py +# default, likely overridden by local_settings.py DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", diff --git a/relate/templates/403.html b/relate/templates/403.html index 39898a632..d9798db09 100644 --- a/relate/templates/403.html +++ b/relate/templates/403.html @@ -16,7 +16,7 @@

{% trans "403 Forbidden" %}

{% url "relate-home" as relate-home %} {% blocktrans trimmed %} You're not currently signed in. Access to the resource is restricted, - and since the site has no way of knowing who you are, it denied you accesss. + and since the site has no way of knowing who you are, it denied you access. Once you're signed in, navigate back to your course from the home page and retry your last action. diff --git a/relate/utils.py b/relate/utils.py index 01b4c6aa2..f68425805 100644 --- a/relate/utils.py +++ b/relate/utils.py @@ -209,7 +209,7 @@ def format_datetime_local( Note: The datetime rendered in template is itself locale aware. A custom format must be defined in settings.py. When a custom format uses a same name with an existing built-in - format, it will be overrided by built-in format if l10n + format, it will be overridden by built-in format if l10n is enabled. """ diff --git a/tests/base_test_mixins.py b/tests/base_test_mixins.py index 27bdcc8d8..7dc5f5895 100644 --- a/tests/base_test_mixins.py +++ b/tests/base_test_mixins.py @@ -869,10 +869,10 @@ def post_create_course(cls, client, create_course_kwargs, *, # noqa: N805 create_course_kwargs["trusted_for_markup"] last_course.save() - url_cache_key, commit_sha_cach_key = ( + url_cache_key, commit_sha_cache_key = ( git_source_url_to_cache_keys(last_course.git_source)) mc.set_multi({url_cache_key: get_course_repo_path(last_course), - commit_sha_cach_key: last_course.active_git_commit_sha}, + commit_sha_cache_key: last_course.active_git_commit_sha}, time=120000 ) return resp @@ -1951,7 +1951,7 @@ def get_hacked_flow_desc( Get a hacked version of flow_desc :param user: the flow_desc viewed by which user, default to a student :param flow_id: the flow_desc of which flow_id, default to `quiz-test` - :param commit_sha: default to corrent running commit_sha + :param commit_sha: default to current running commit_sha :param kwargs: the attributes of the hacked flow_dec :return: the faked flow_desc """ @@ -2420,7 +2420,7 @@ def submit_page_human_grading_by_page_id_and_test( expected_post_grading_status_code=200, grade_data=None, expected_grades=None, - do_session_score_equal_assersion=True, + do_session_score_equal_assertion=True, grade_data_extra_kwargs=None, force_login_instructor=True, ensure_grading_ui_get_before_grading=False, @@ -2473,7 +2473,7 @@ def submit_page_human_grading_by_page_id_and_test( == expected_post_grading_status_code) if post_grade_response.status_code == 200: - if do_session_score_equal_assersion: + if do_session_score_equal_assertion: cls.assertSessionScoreEqual(expected_grades) if ensure_download_after_grading: @@ -2500,10 +2500,10 @@ class MockAddMessageMixing: def setUp(self): super().setUp() self._fake_add_message_path = "django.contrib.messages.add_message" - fake_add_messag = mock.patch(self._fake_add_message_path) + fake_add_message = mock.patch(self._fake_add_message_path) - self._mock_add_message = fake_add_messag.start() - self.addCleanup(fake_add_messag.stop) + self._mock_add_message = fake_add_message.start() + self.addCleanup(fake_add_message.stop) def _get_added_messages(self, join=True): try: diff --git a/tests/resource.py b/tests/resource.py index 07a7b9eaa..6fa0f5473 100644 --- a/tests/resource.py +++ b/tests/resource.py @@ -45,7 +45,7 @@ def my_get_masked_profile_method_return_none(u): return -def my_get_masked_profile_method_return_emtpy_string(u): +def my_get_masked_profile_method_return_empty_string(u): return " " diff --git a/tests/test_auth.py b/tests/test_auth.py index 9df88c73b..3fa276531 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -989,7 +989,7 @@ def setUp(self): self.client.logout() @override_settings() - def test_signup_registeration_not_enabled(self): + def test_signup_registration_not_enabled(self): settings.RELATE_REGISTRATION_ENABLED = False resp = self.get_sign_up() self.assertEqual(resp.status_code, 400) @@ -1804,7 +1804,7 @@ def test_reset_stage2_invalid_token(self): self.assertAddMessageCalledWith(expected_msg) self.assertHasNoUserLoggedIn() - def test_reset_stage2_get_sucess(self): + def test_reset_stage2_get_success(self): resp = self.get_reset_password_stage2(self.user.id, self.user.sign_in_key) self.assertEqual(resp.status_code, 200) self.assertHasNoUserLoggedIn() diff --git a/tests/test_checks.py b/tests/test_checks.py index 5170e273b..5b3c816ca 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -246,10 +246,10 @@ def test_passed_check_but_return_empty_string(self): with override_settings( RELATE_USER_PROFILE_MASK_METHOD=( "tests.resource" - ".my_get_masked_profile_method_return_emtpy_string")): + ".my_get_masked_profile_method_return_empty_string")): self.assertCheckMessages([]) from tests.resource import ( - my_get_masked_profile_method_return_emtpy_string as custom_method, + my_get_masked_profile_method_return_empty_string as custom_method, ) # test method can run @@ -491,7 +491,7 @@ def test_valid_email_connections_none(self): self.assertCheckMessages([]) @override_settings(EMAIL_CONNECTIONS=VALID_CONF_EMPTY_DICT) - def test_valid_email_connections_emtpy_dict(self): + def test_valid_email_connections_empty_dict(self): self.assertCheckMessages([]) @override_settings(EMAIL_CONNECTIONS=VALID_CONF) @@ -580,12 +580,12 @@ def valid_func(now_datetime): self.assertCheckMessages([]) def test_valid_relate_facilities_callable_with_empty_ip_ranges(self): - def valid_func_though_return_emtpy_ip_ranges(now_datetime): - # this won't result in warnning, because the facility is defined + def valid_func_though_return_empty_ip_ranges(now_datetime): + # this won't result in warning, because the facility is defined # by a callable. return self.WARNING_CONF_IP_RANGES_NOT_CONFIGURED with override_settings( - RELATE_FACILITIES=valid_func_though_return_emtpy_ip_ranges): + RELATE_FACILITIES=valid_func_though_return_empty_ip_ranges): self.assertCheckMessages([]) @override_settings(RELATE_FACILITIES=INVALID_CONF_LIST) @@ -653,7 +653,7 @@ def test_valid_maintenance_mode_exceptions_none(self): self.assertCheckMessages([]) @override_settings(RELATE_MAINTENANCE_MODE_EXCEPTIONS=VALID_CONF_EMPTY_LIST) - def test_valid_maintenance_mode_exceptions_emtpy_list(self): + def test_valid_maintenance_mode_exceptions_empty_list(self): self.assertCheckMessages([]) @override_settings(RELATE_MAINTENANCE_MODE_EXCEPTIONS=VALID_CONF) @@ -849,7 +849,7 @@ class CheckRelateCourseLanguages(CheckRelateSettingsBase): ("zh-hans", "Simplified Chinese"), ("de", _("German"))) - VALID_WITH_WARNNING_CONF = ( + VALID_WITH_WARNING_CONF = ( ("en", "English"), ("zh-hans", "Simplified Chinese"), ("zh-hans", "my Simplified Chinese"), @@ -909,7 +909,7 @@ def test_item_having_same_lang_code_with_settings_language_code(self): self.assertCheckMessages([]) def test_item_duplicated_inside_settings_languages(self): - with override_settings(LANGUAGES=self.VALID_WITH_WARNNING_CONF, + with override_settings(LANGUAGES=self.VALID_WITH_WARNING_CONF, LANGUAGE_CODE="en-us"): self.assertCheckMessages( expected_ids=["relate_languages.W001"], @@ -1059,8 +1059,8 @@ def test_warning_conf_false(self): class RelateStartupChecksExtraCheckTest(CheckRelateSettingsBase): msg_id_prefix = "my_custom_check_msg" - INSTANCE_WRONG1 = "tests.resouce.my_check_func" - INSTANCE_WRONG2 = {"path": "tests.resouce.my_check_func"} + INSTANCE_WRONG1 = "tests.resource.my_check_func" + INSTANCE_WRONG2 = {"path": "tests.resource.my_check_func"} @override_settings() def test_not_configured(self): diff --git a/tests/test_constants.py b/tests/test_constants.py index 997971fc7..2d6bb5625 100644 --- a/tests/test_constants.py +++ b/tests/test_constants.py @@ -51,7 +51,7 @@ def test_end(self): self.assertTrue( constants.is_expiration_mode_allowed(expmode, permissions)) - def test_unkown_mode(self): + def test_unknown_mode(self): expmode = "unknown_mode" permissions = frozenset([]) diff --git a/tests/test_content.py b/tests/test_content.py index 1564ac325..46e43d1ab 100644 --- a/tests/test_content.py +++ b/tests/test_content.py @@ -375,7 +375,7 @@ def test(self): ## link to another course [A static page](course:another-course) - ## calendar linkes + ## calendar links [A static page](calendar:) ## images diff --git a/tests/test_enrollment.py b/tests/test_enrollment.py index b23fa790d..3e429a447 100644 --- a/tests/test_enrollment.py +++ b/tests/test_enrollment.py @@ -61,7 +61,7 @@ # {{{ message constants MESSAGE_ENROLLMENT_SENT_TEXT = ( - "Enrollment request sent. You will receive notifcation " + "Enrollment request sent. You will receive notification " "by email once your request has been acted upon.") MESSAGE_ENROLL_REQUEST_PENDING_TEXT = ( "Your enrollment request is pending. You will be " @@ -161,7 +161,7 @@ def get_test_preapproval(self, **kwargs): return factories.ParticipationPreapprovalFactory(**defaults) - def assertParticiaptionStatusCallCount(self, expected_counts): # noqa + def assertParticipationStatusCallCount(self, expected_counts): # noqa from collections import OrderedDict d = OrderedDict() counts = [] @@ -202,53 +202,53 @@ class EnrollViewTest(EnrollmentTestMixin, TestCase): def test_participation_status_requested(self): participation = self.get_test_participation( status=p_status.requested) - self.assertParticiaptionStatusCallCount([0, 0, 0, 1]) + self.assertParticipationStatusCallCount([0, 0, 0, 1]) with self.temporarily_switch_to_user(participation.user): resp = self.client.post(self.enroll_request_url) self.assertRedirects( resp, self.course_page_url, fetch_redirect_response=False) self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_ENROLL_REQUEST_ALREADY_PENDING_TEXT) - self.assertParticiaptionStatusCallCount([0, 0, 0, 1]) + self.assertParticipationStatusCallCount([0, 0, 0, 1]) self.assertEqual(len(mail.outbox), 0) def test_participation_status_denied(self): participation = self.get_test_participation( status=p_status.denied) - self.assertParticiaptionStatusCallCount([0, 1, 0, 0]) + self.assertParticipationStatusCallCount([0, 1, 0, 0]) with self.temporarily_switch_to_user(participation.user): resp = self.client.post(self.enroll_request_url) self.assertRedirects( resp, self.course_page_url, fetch_redirect_response=False) self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_ENROLL_DENIED_NOT_ALLOWED_TEXT) - self.assertParticiaptionStatusCallCount([0, 1, 0, 0]) + self.assertParticipationStatusCallCount([0, 1, 0, 0]) self.assertEqual(len(mail.outbox), 0) def test_participation_status_dropped(self): participation = self.get_test_participation( status=p_status.dropped) - self.assertParticiaptionStatusCallCount([0, 0, 1, 0]) + self.assertParticipationStatusCallCount([0, 0, 1, 0]) with self.temporarily_switch_to_user(participation.user): resp = self.client.post(self.enroll_request_url) self.assertRedirects( resp, self.course_page_url, fetch_redirect_response=False) self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_ENROLL_DROPPED_NOT_ALLOWED_TEXT) - self.assertParticiaptionStatusCallCount([0, 0, 1, 0]) + self.assertParticipationStatusCallCount([0, 0, 1, 0]) self.assertEqual(len(mail.outbox), 0) def test_participation_status_active(self): participation = self.get_test_participation( status=p_status.active) - self.assertParticiaptionStatusCallCount([1, 0, 0, 0]) + self.assertParticipationStatusCallCount([1, 0, 0, 0]) with self.temporarily_switch_to_user(participation.user): resp = self.client.post(self.enroll_request_url) self.assertRedirects( resp, self.course_page_url, fetch_redirect_response=False) self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_CANNOT_REENROLL_TEXT) - self.assertParticiaptionStatusCallCount([1, 0, 0, 0]) + self.assertParticipationStatusCallCount([1, 0, 0, 0]) self.assertEqual(len(mail.outbox), 0) def test_not_accepts_enrollment(self): @@ -261,7 +261,7 @@ def test_not_accepts_enrollment(self): resp, self.course_page_url, fetch_redirect_response=False) self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_NOT_ACCEPTING_ENROLLMENTS_TEXT) - self.assertParticiaptionStatusCallCount([0, 0, 0, 0]) + self.assertParticipationStatusCallCount([0, 0, 0, 0]) self.assertEqual(len(mail.outbox), 0) def test_not_post_request(self): @@ -273,7 +273,7 @@ def test_not_post_request(self): self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith( MESSAGE_ENROLL_ONLY_ACCEPT_POST_REQUEST_TEXT) - self.assertParticiaptionStatusCallCount([0, 0, 0, 0]) + self.assertParticipationStatusCallCount([0, 0, 0, 0]) self.assertEqual(len(mail.outbox), 0) def test_user_not_active(self): @@ -288,7 +288,7 @@ def test_user_not_active(self): self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith( MESSAGE_EMAIL_NOT_CONFIRMED_TEXT) - self.assertParticiaptionStatusCallCount([0, 0, 0, 0]) + self.assertParticipationStatusCallCount([0, 0, 0, 0]) self.assertEqual(len(mail.outbox), 0) def test_no_restrictions(self): @@ -300,7 +300,7 @@ def test_no_restrictions(self): self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_SUCCESSFULLY_ENROLLED_TEXT) - self.assertParticiaptionStatusCallCount([1, 0, 0, 0]) + self.assertParticipationStatusCallCount([1, 0, 0, 0]) def test_no_restrictions_user_has_no_instid(self): user = factories.UserFactory(institutional_id=None) @@ -311,7 +311,7 @@ def test_no_restrictions_user_has_no_instid(self): self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_SUCCESSFULLY_ENROLLED_TEXT) - self.assertParticiaptionStatusCallCount([1, 0, 0, 0]) + self.assertParticipationStatusCallCount([1, 0, 0, 0]) def test_not_matching_preapproved_email(self): self.update_require_approval_course() @@ -325,7 +325,7 @@ def test_not_matching_preapproved_email(self): self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_ENROLLMENT_SENT_TEXT) self.assertEqual(len(mail.outbox), 1) - self.assertParticiaptionStatusCallCount([0, 0, 0, 1]) + self.assertParticipationStatusCallCount([0, 0, 0, 1]) def test_matched_preapproved_email(self): self.update_require_approval_course() @@ -338,7 +338,7 @@ def test_matched_preapproved_email(self): resp, self.course_page_url, fetch_redirect_response=False) self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_SUCCESSFULLY_ENROLLED_TEXT) - self.assertParticiaptionStatusCallCount([1, 0, 0, 0]) + self.assertParticipationStatusCallCount([1, 0, 0, 0]) self.assertEqual(len(mail.outbox), 1) def test_course_not_require_inst_id_verified(self): @@ -357,7 +357,7 @@ def test_course_not_require_inst_id_verified(self): self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_SUCCESSFULLY_ENROLLED_TEXT) - self.assertParticiaptionStatusCallCount([2, 0, 0, 0]) + self.assertParticipationStatusCallCount([2, 0, 0, 0]) self.assertEqual(len(mail.outbox), 2) def test_course_require_inst_id_verified_user_inst_id_verified1(self): @@ -374,7 +374,7 @@ def test_course_require_inst_id_verified_user_inst_id_verified1(self): resp, self.course_page_url, fetch_redirect_response=False) self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_SUCCESSFULLY_ENROLLED_TEXT) - self.assertParticiaptionStatusCallCount([1, 0, 0, 0]) + self.assertParticipationStatusCallCount([1, 0, 0, 0]) self.assertEqual(len(mail.outbox), 1) def test_course_require_inst_id_verified_user_inst_id_verified2(self): @@ -392,7 +392,7 @@ def test_course_require_inst_id_verified_user_inst_id_verified2(self): self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_ENROLLMENT_SENT_TEXT) self.assertEqual(len(mail.outbox), 1) - self.assertParticiaptionStatusCallCount([0, 0, 0, 1]) + self.assertParticipationStatusCallCount([0, 0, 0, 1]) def test_preapprved_user_updated_inst_id_after_req_enrollment_roles_match(self): # Check assigned roles, testing issue #735 @@ -437,7 +437,7 @@ def test_course_require_inst_id_verified_user_inst_id_not_verified1(self): resp, self.course_page_url, fetch_redirect_response=False) self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_ENROLLMENT_SENT_TEXT) - self.assertParticiaptionStatusCallCount([0, 0, 0, 1]) + self.assertParticipationStatusCallCount([0, 0, 0, 1]) self.assertEqual(len(mail.outbox), 1) def test_course_require_inst_id_verified_user_inst_id_not_verified2(self): @@ -454,7 +454,7 @@ def test_course_require_inst_id_verified_user_inst_id_not_verified2(self): resp, self.course_page_url, fetch_redirect_response=False) self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_ENROLLMENT_SENT_TEXT) - self.assertParticiaptionStatusCallCount([0, 0, 0, 1]) + self.assertParticipationStatusCallCount([0, 0, 0, 1]) self.assertEqual(len(mail.outbox), 1) def test_course_require_email_suffix_but_need_approval(self): @@ -469,7 +469,7 @@ def test_course_require_email_suffix_but_need_approval(self): resp, self.course_page_url, fetch_redirect_response=False) self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_ENROLLMENT_SENT_TEXT) - self.assertParticiaptionStatusCallCount([0, 0, 0, 1]) + self.assertParticipationStatusCallCount([0, 0, 0, 1]) self.assertEqual(len(mail.outbox), 1) def test_course_require_email_suffix_passed_without_at(self): @@ -484,7 +484,7 @@ def test_course_require_email_suffix_passed_without_at(self): resp, self.course_page_url, fetch_redirect_response=False) self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_ENROLLMENT_SENT_TEXT) - self.assertParticiaptionStatusCallCount([0, 0, 0, 1]) + self.assertParticipationStatusCallCount([0, 0, 0, 1]) self.assertEqual(len(mail.outbox), 1) def test_course_require_email_suffix_passed_without_at_pattern2(self): @@ -499,7 +499,7 @@ def test_course_require_email_suffix_passed_without_at_pattern2(self): resp, self.course_page_url, fetch_redirect_response=False) self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_ENROLLMENT_SENT_TEXT) - self.assertParticiaptionStatusCallCount([0, 0, 0, 1]) + self.assertParticipationStatusCallCount([0, 0, 0, 1]) self.assertEqual(len(mail.outbox), 1) def test_course_require_email_suffix_failed(self): @@ -515,7 +515,7 @@ def test_course_require_email_suffix_failed(self): self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith( MESSAGE_EMAIL_SUFFIX_REQUIRED_PATTERN % required_suffix) - self.assertParticiaptionStatusCallCount([0, 0, 0, 0]) + self.assertParticipationStatusCallCount([0, 0, 0, 0]) self.assertEqual(len(mail.outbox), 0) def test_integrity_error(self): @@ -532,7 +532,7 @@ def test_integrity_error(self): self.assertAddMessageCallCount(1) self.assertAddMessageCalledWith(MESSAGE_PARTICIPATION_ALREADY_EXIST_TEXT) - self.assertParticiaptionStatusCallCount([0, 0, 0, 0]) + self.assertParticipationStatusCallCount([0, 0, 0, 0]) class HandleEnrollmentRequestTest(SingleCourseTestMixin, diff --git a/tests/test_exam.py b/tests/test_exam.py index 5ce7fb64b..75282e9e1 100644 --- a/tests/test_exam.py +++ b/tests/test_exam.py @@ -457,8 +457,8 @@ def test_get_user(self): class IsFromExamsOnlyFacilityTest(unittest.TestCase): """test exam.is_from_exams_only_facility""" def setUp(self): - self.requset = mock.MagicMock() - self.requset.relate_facilities = ["fa1", "fa2"] + self.request = mock.MagicMock() + self.request.relate_facilities = ["fa1", "fa2"] fake_get_facilities_config = mock.patch( "course.utils.get_facilities_config") self.mock_get_facilities_config = fake_get_facilities_config.start() @@ -468,17 +468,17 @@ def test_true(self): self.mock_get_facilities_config.return_value = { "fa1": {"exams_only": False, "ip_range": "foo"}, "fa2": {"exams_only": True, "ip_range": "bar"}} - self.assertTrue(exam.is_from_exams_only_facility(self.requset)) + self.assertTrue(exam.is_from_exams_only_facility(self.request)) def test_false(self): self.mock_get_facilities_config.return_value = {} - self.assertFalse(exam.is_from_exams_only_facility(self.requset)) + self.assertFalse(exam.is_from_exams_only_facility(self.request)) def test_false_2(self): self.mock_get_facilities_config.return_value = { "fa1": {"exams_only": False, "ip_range": "foo"}, "fa3": {"exams_only": True, "ip_range": "bar"}} - self.assertFalse(exam.is_from_exams_only_facility(self.requset)) + self.assertFalse(exam.is_from_exams_only_facility(self.request)) class GetLoginExamTicketTest(ExamTestMixin, TestCase): @@ -930,7 +930,7 @@ def test_ok_with_saml2_views(self): self.assertAddMessageCallCount(0) def test_ok_with_select2_views(self): - # There's curently no views using select2 when locked down. + # There's currently no views using select2 when locked down. # Here we are testing by using link from the select2 widget of # impersonating form with self.temporarily_switch_to_user(self.ta_participation.user): diff --git a/tests/test_flow/test_flow.py b/tests/test_flow/test_flow.py index 81b4fe8e3..0dbec4c65 100644 --- a/tests/test_flow/test_flow.py +++ b/tests/test_flow/test_flow.py @@ -95,26 +95,26 @@ def test_remove_rename_and_revive(self): resp = self.client.get(self.get_page_url_by_ordinal(0)) self.assertEqual(resp.status_code, 200) - fpds_2nd = models.FlowPageData.objects.all() - welcome_page_title_2nd = fpds_2nd.get(page_id="welcome").title - fpd_ids_2nd = list(fpds_2nd.values_list("page_id", flat=True)) + fpds_2and = models.FlowPageData.objects.all() + welcome_page_title_2and = fpds_2and.get(page_id="welcome").title + fpd_ids_2and = list(fpds_2and.values_list("page_id", flat=True)) # the page (with page_id "welcome") has changed title - self.assertNotEqual(welcome_page_title_1st, welcome_page_title_2nd) + self.assertNotEqual(welcome_page_title_1st, welcome_page_title_2and) # these two pages have removed page_ordinal # (those in group2 are not considered) - page_ids_removed_in_2nd = {"half1", "lsq2"} + page_ids_removed_in_2and = {"half1", "lsq2"} self.assertTrue( - page_ids_removed_in_2nd - < set(fpds_2nd.filter( + page_ids_removed_in_2and + < set(fpds_2and.filter( page_ordinal=None).values_list("page_id", flat=True))) - page_ids_introduced_in_2nd = {"half1_id_renamed", "half_again2"} - self.assertNotIn(page_ids_introduced_in_2nd, fpd_ids_1st) - self.assertTrue(page_ids_introduced_in_2nd < set(fpd_ids_2nd)) + page_ids_introduced_in_2and = {"half1_id_renamed", "half_again2"} + self.assertNotIn(page_ids_introduced_in_2and, fpd_ids_1st) + self.assertTrue(page_ids_introduced_in_2and < set(fpd_ids_2and)) - self.assertTrue(set(fpd_ids_2nd) > set(fpd_ids_1st)) + self.assertTrue(set(fpd_ids_2and) > set(fpd_ids_1st)) # }}} # {{{ 3rd round: revive back @@ -126,16 +126,16 @@ def test_remove_rename_and_revive(self): fpds_3rd = models.FlowPageData.objects.all() fpd_ids_3rd = list(fpds_3rd.values_list("page_id", flat=True)) - welcome_page_title_3rd = fpds_2nd.get(page_id="welcome").title + welcome_page_title_3rd = fpds_2and.get(page_id="welcome").title self.assertEqual(welcome_page_title_1st, welcome_page_title_3rd) # no page_data instances are removed - self.assertSetEqual(set(fpd_ids_2nd), set(fpd_ids_3rd)) + self.assertSetEqual(set(fpd_ids_2and), set(fpd_ids_3rd)) self.assertSetEqual( - page_ids_introduced_in_2nd, + page_ids_introduced_in_2and, set(fpds_3rd.filter( page_ordinal=None).values_list("page_id", flat=True))) - for page_id in page_ids_removed_in_2nd: + for page_id in page_ids_removed_in_2and: self.assertIsNotNone( models.FlowPageData.objects.get(page_id=page_id).page_ordinal) # }}} @@ -204,7 +204,7 @@ def test_page_answer_not_gradable(self): "Unexpectedly created FlowPageVisitGrade objects for " "ungradedable questions which expects answer.") - def test_answer_feeback_is_none(self): + def test_answer_feedback_is_none(self): with self.temporarily_switch_to_user(self.student_participation.user): with mock.patch( "course.page.upload.FileUploadQuestion.grade") as mock_grade: @@ -992,7 +992,7 @@ def test_submit_all_correct_all_graded(self): for page_id in page_ids: self.submit_page_human_grading_by_page_id_and_test( - page_id, do_session_score_equal_assersion=False) + page_id, do_session_score_equal_assertion=False) expected_grade_info_dict = { "fully_correct_count": 3, @@ -1048,15 +1048,15 @@ def test_submit_with_partial_correct_or_incorrect_and_all_graded(self): if page_id == "anyup": self.submit_page_human_grading_by_page_id_and_test( page_id, grade_data={"grade_percent": "0", "released": "on"}, - do_session_score_equal_assersion=False) + do_session_score_equal_assertion=False) if page_id == "proof": self.submit_page_human_grading_by_page_id_and_test( page_id, grade_data={"grade_percent": "70", "released": "on"}, - do_session_score_equal_assersion=False) + do_session_score_equal_assertion=False) else: self.submit_page_human_grading_by_page_id_and_test( - page_id, do_session_score_equal_assersion=False) + page_id, do_session_score_equal_assertion=False) expected_grade_info_dict = { "fully_correct_count": 1, @@ -1103,15 +1103,15 @@ def test_submit_with_bonus(self): self.submit_page_human_grading_by_page_id_and_test( page_id, grade_data={"grade_percent": "0", "released": "on"}, - do_session_score_equal_assersion=False) + do_session_score_equal_assertion=False) if page_id == "proof": self.submit_page_human_grading_by_page_id_and_test( page_id, grade_data={"grade_percent": "70", "released": "on"}, - do_session_score_equal_assersion=False) + do_session_score_equal_assertion=False) else: self.submit_page_human_grading_by_page_id_and_test( - page_id, do_session_score_equal_assersion=False) + page_id, do_session_score_equal_assertion=False) expected_grade_info_dict = { "fully_correct_count": 1, @@ -1287,11 +1287,11 @@ def test_finish_non_in_progress_session(self): "Cannot end a session that's already ended", self.mock_add_message.call_args[0]) - def test_notify_on_submit_emtpy(self): + def test_notify_on_submit_empty(self): with mock.patch("course.utils.get_flow_desc") as mock_get_flow_desc: mock_get_flow_desc.return_value = ( self.get_hacked_flow_desc( - # no recepient + # no recipient notify_on_submit=[]) ) self.start_flow(self.flow_id) @@ -1713,7 +1713,7 @@ def setUp(self): self.now_datatime = now() - def test_expire_non_in_progess_session(self): + def test_expire_non_in_progress_session(self): flow_session = factories.FlowSessionFactory( participation=self.student_participation, in_progress=False) grading_rule = mock.MagicMock() @@ -2203,7 +2203,7 @@ def test_has_identical_previous_grade_changes(self): grade_info = self.get_test_grade_info() self.mock_gather_grade_info.return_value = grade_info - # create an indentical previous_grade_changes + # create an identical previous_grade_changes grade_time1 = now() - timedelta(days=1) grade_time2 = grade_time1 + timedelta(hours=1) @@ -3213,7 +3213,7 @@ def test_cooldown_seconds_worked(self): mock_session.pk = 0 self.mock_start_flow.return_value = mock_session - # create an exising session started recently + # create an existing session started recently factories.FlowSessionFactory(participation=self.student_participation) self.start_flow(self.flow_id, ignore_cool_down=False, @@ -3233,7 +3233,7 @@ def test_cooldown_seconds_dued(self): mock_session.pk = 0 self.mock_start_flow.return_value = mock_session - # create an exising session started recently + # create an existing session started recently factories.FlowSessionFactory( participation=self.student_participation, start_time=now() - timedelta(seconds=11)) @@ -4573,7 +4573,7 @@ class SendEmailAboutFlowPageTest(HackRepoMixin, def setUpTestData(cls): super().setUpTestData() - # We only conern one page, so it can be put here to speed up + # We only concern one page, so it can be put here to speed up client = Client() client.force_login(cls.student_participation.user) cls.start_flow(client, cls.flow_id) @@ -4972,9 +4972,9 @@ def setUp(self): self.mock_redirect = fake_redirect.start() self.addCleanup(fake_redirect.stop) - def get_regrade_flows_view_url(self, course_identfier=None): - course_identfier = course_identfier or self.get_default_course_identifier() - return reverse("relate-regrade_flows_view", args=(course_identfier,)) + def get_regrade_flows_view_url(self, course_identifier=None): + course_identifier = course_identifier or self.get_default_course_identifier() + return reverse("relate-regrade_flows_view", args=(course_identifier,)) def test_no_pperm(self): with self.temporarily_switch_to_user(self.student_participation.user): diff --git a/tests/test_grades/test_csv.py b/tests/test_grades/test_csv.py index 4b9e1e7b1..3f79d700d 100644 --- a/tests/test_grades/test_csv.py +++ b/tests/test_grades/test_csv.py @@ -469,7 +469,7 @@ def sf(row, index): self.assertEqual(models.GradeChange.objects.count(), 0) def test_import_csv_other_error(self): - error_msg = ("Some other unkown error") + error_msg = ("Some other unknown error") expected_file_error_msg = ( "Error: TypeError: %s" % error_msg) diff --git a/tests/test_grades/test_generic.py b/tests/test_grades/test_generic.py index fa7093c67..08257d69c 100644 --- a/tests/test_grades/test_generic.py +++ b/tests/test_grades/test_generic.py @@ -51,7 +51,7 @@ def do_quiz(cls, client, participation): # noqa: N805 cls.flow_session_ids.append( int(cls.default_flow_params["flow_session_id"])) - # Seperate the test here + # Separate the test here def test_grading_opportunity(self): # Should only have one grading opportunity object self.assertEqual(GradingOpportunity.objects.all().count(), 1) @@ -313,7 +313,7 @@ def setUpTestData(cls): # noqa def setUp(self): super().setUp() - # Make sure the instructor is logged in after all quizes finished + # Make sure the instructor is logged in after all quizzes finished self.client.force_login(self.instructor_participation.user) @@ -333,7 +333,7 @@ def setUpTestData(cls): # noqa def setUp(self): super().setUp() - # Make sure the instructor is logged in after all quizes finished + # Make sure the instructor is logged in after all quizzes finished self.client.force_login(self.instructor_participation.user) diff --git a/tests/test_grades/test_grades.py b/tests/test_grades/test_grades.py index 25ac62d01..451e2609a 100644 --- a/tests/test_grades/test_grades.py +++ b/tests/test_grades/test_grades.py @@ -31,7 +31,7 @@ from course import constants, grades, models from course.constants import ( - grade_aggregation_strategy as g_stragety, + grade_aggregation_strategy as g_strategy, grade_state_change_types as g_state, participation_permission as pperm, ) @@ -67,7 +67,7 @@ class GradesTestMixin(SingleCoursePageTestMixin, MockAddMessageMixing): def setUpTestData(cls): super().setUpTestData() cls.gopp = factories.GradingOpportunityFactory( - course=cls.course, aggregation_strategy=g_stragety.use_latest) + course=cls.course, aggregation_strategy=g_strategy.use_latest) def setUp(self): super().setUp() @@ -761,7 +761,7 @@ def test_batch_op_no_permission(self): self.mock_recalculate_ended_sessions.call_count, 0) def test_batch_op_no_permission2(self): - # with partitial permission + # with partial permission permission_ops = [ (pperm.batch_end_flow_session, "end"), (pperm.batch_impose_flow_session_deadline, "expire"), @@ -968,13 +968,13 @@ def test_default_setup(self): def test_change_aggregate_strategy_average(self): self.use_default_setup() - self.update_gopp_strategy(g_stragety.avg_grade) + self.update_gopp_strategy(g_strategy.avg_grade) self.assertGradeChangeMachineReadableStateEqual(4.333) self.assertGradeChangeStateEqual("4.3% (/3)") def test_change_aggregate_strategy_earliest(self): self.use_default_setup() - self.update_gopp_strategy(g_stragety.use_earliest) + self.update_gopp_strategy(g_strategy.use_earliest) self.assertGradeChangeMachineReadableStateEqual(0) self.assertGradeChangeStateEqual("0.0% (/3)") @@ -985,7 +985,7 @@ def test_change_aggregate_strategy_earliest(self): def test_change_aggregate_strategy_max(self): self.use_default_setup() - self.update_gopp_strategy(g_stragety.max_grade) + self.update_gopp_strategy(g_strategy.max_grade) self.assertGradeChangeMachineReadableStateEqual(7) self.assertGradeChangeStateEqual("7.0% (/3)") @@ -996,7 +996,7 @@ def test_change_aggregate_strategy_max(self): def test_change_aggregate_strategy_max_none(self): # when no grade change has percentage - self.update_gopp_strategy(g_stragety.max_grade) + self.update_gopp_strategy(g_strategy.max_grade) self.assertGradeChangeMachineReadableStateEqual("NONE") self.assertGradeChangeStateEqual("- ∅ -") @@ -1011,13 +1011,13 @@ def test_change_aggregate_strategy_max_none(self): def test_change_aggregate_strategy_min(self): self.use_default_setup() - self.update_gopp_strategy(g_stragety.min_grade) + self.update_gopp_strategy(g_strategy.min_grade) self.assertGradeChangeMachineReadableStateEqual(0) self.assertGradeChangeStateEqual("0.0% (/3)") def test_change_aggregate_strategy_min_none(self): # when no grade change has percentage - self.update_gopp_strategy(g_stragety.min_grade) + self.update_gopp_strategy(g_strategy.min_grade) self.assertGradeChangeMachineReadableStateEqual("NONE") self.assertGradeChangeStateEqual("- ∅ -") @@ -1077,7 +1077,7 @@ def test_update_latest_gc_of_latest_finished_session(self): self.assertGradeChangeMachineReadableStateEqual(10) self.assertGradeChangeStateEqual("10.0% (/3)") - def test_update_ealiest_gc_of_ealier_finished_session(self): + def test_update_earliest_gc_of_earlier_finished_session(self): self.use_default_setup() self.assertGradeChangeMachineReadableStateEqual(6) @@ -1087,7 +1087,7 @@ def test_update_ealiest_gc_of_ealier_finished_session(self): def test_gc_without_attempt_id(self): # TODO: Is it a bug? percentage of GradeChanges without attempt_id are - # put at the begining of the valid_percentages list. + # put at the beginning of the valid_percentages list. # Uncomment the following to see the failure # self.use_default_setup() @@ -1234,12 +1234,12 @@ def setUp(self): super().setUp() self.use_default_setup() self.gopp_hidden_in_gradebook = factories.GradingOpportunityFactory( - course=self.course, aggregation_strategy=g_stragety.use_latest, + course=self.course, aggregation_strategy=g_strategy.use_latest, flow_id=None, shown_in_grade_book=False, identifier="hidden_in_instructor_grade_book") self.gopp_hidden_in_gradebook = factories.GradingOpportunityFactory( - course=self.course, aggregation_strategy=g_stragety.use_latest, + course=self.course, aggregation_strategy=g_strategy.use_latest, flow_id=None, shown_in_grade_book=False, identifier="only_hidden_in_grade_book") @@ -1247,13 +1247,13 @@ def setUp(self): factories.GradingOpportunityFactory( course=self.course, shown_in_participant_grade_book=False, - aggregation_strategy=g_stragety.use_latest, + aggregation_strategy=g_strategy.use_latest, flow_id=None, identifier="all_hidden_in_ptcp_gradebook")) self.gopp_result_hidden_in_participation_gradebook = ( factories.GradingOpportunityFactory( course=self.course, result_shown_in_participant_grade_book=False, - aggregation_strategy=g_stragety.use_latest, + aggregation_strategy=g_strategy.use_latest, flow_id=None, identifier="result_hidden_in_ptcp_gradebook")) self.gc_gopp_result_hidden = factories.GradeChangeFactory( @@ -1688,7 +1688,7 @@ def post_edit_grading_opportunity_view(self, opp_id, data, def edit_grading_opportunity_post_data( self, name, identifier, page_scores_in_participant_gradebook=False, hide_superseded_grade_history_before=None, - op="sumbit", shown_in_participant_grade_book=True, + op="submit", shown_in_participant_grade_book=True, aggregation_strategy=constants.grade_aggregation_strategy.use_latest, shown_in_grade_book=True, result_shown_in_participant_grade_book=True, **kwargs): @@ -1819,9 +1819,9 @@ def setUpTestData(cls): cls.end_flow(client) # create an in_progress flow, with the same page submitted - another_particpation = factories.ParticipationFactory( + another_participation = factories.ParticipationFactory( course=cls.course) - client.force_login(another_particpation.user) + client.force_login(another_participation.user) cls.start_flow(client, cls.flow_id) cls.submit_page_answer_by_page_id_and_test(client, cls.page_id) @@ -2054,7 +2054,7 @@ def test_new_gchange_created_when_finish_flow_use_last_has_activity(self): # {{{ Fixed issue #263 and #417 - def test_update_latest_gc_of_ealier_finished_session(self): + def test_update_latest_gc_of_earlier_finished_session(self): self.use_default_setup() self.assertGradeChangeMachineReadableStateEqual(6) diff --git a/tests/test_misc.py b/tests/test_misc.py index 5e78109a1..90a74071a 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -56,12 +56,12 @@ ("fr", _("French")), ] -ASSERSION_ERROR_LANGUAGE_PATTERN = ( +ASSERTION_ERROR_LANGUAGE_PATTERN = ( "%s page visiting results don't match in terms of " "whether the response contains Korean characters." ) -ASSERSION_ERROR_CONTENT_LANGUAGE_PATTERN = ( +ASSERTION_ERROR_CONTENT_LANGUAGE_PATTERN = ( "%s page visiting result don't match in terms of " "whether the response content-language are restored." ) @@ -146,13 +146,13 @@ def assertResponseBehaveLikeUnconfigured(self): # noqa self.assertEqual( self.home_resp_contains_korean_with_diff_settings()[0], expected_result[0], - ASSERSION_ERROR_LANGUAGE_PATTERN % "Home" + ASSERTION_ERROR_LANGUAGE_PATTERN % "Home" ) self.assertEqual( self.home_resp_contains_korean_with_diff_settings()[1], expected_result[1], - ASSERSION_ERROR_CONTENT_LANGUAGE_PATTERN % "Home" + ASSERTION_ERROR_CONTENT_LANGUAGE_PATTERN % "Home" ) expected_result = ([False, True, False, True], @@ -160,12 +160,12 @@ def assertResponseBehaveLikeUnconfigured(self): # noqa self.assertEqual( self.course_resp_contains_korean_with_diff_settings()[0], expected_result[0], - ASSERSION_ERROR_LANGUAGE_PATTERN % "Course" + ASSERTION_ERROR_LANGUAGE_PATTERN % "Course" ) self.assertEqual( self.course_resp_contains_korean_with_diff_settings()[1], expected_result[1], - ASSERSION_ERROR_CONTENT_LANGUAGE_PATTERN % "Course" + ASSERTION_ERROR_CONTENT_LANGUAGE_PATTERN % "Course" ) def assertResponseBehaveAsExpectedForCourseWithForceLang(self): # noqa @@ -175,13 +175,13 @@ def assertResponseBehaveAsExpectedForCourseWithForceLang(self): # noqa self.assertEqual( self.home_resp_contains_korean_with_diff_settings()[0], expected_result[0], - ASSERSION_ERROR_LANGUAGE_PATTERN % "Home" + ASSERTION_ERROR_LANGUAGE_PATTERN % "Home" ) self.assertEqual( self.home_resp_contains_korean_with_diff_settings()[1], expected_result[1], - ASSERSION_ERROR_CONTENT_LANGUAGE_PATTERN % "Home" + ASSERTION_ERROR_CONTENT_LANGUAGE_PATTERN % "Home" ) expected_result = ([True, True, True, True], @@ -189,12 +189,12 @@ def assertResponseBehaveAsExpectedForCourseWithForceLang(self): # noqa self.assertEqual( self.course_resp_contains_korean_with_diff_settings()[0], expected_result[0], - ASSERSION_ERROR_LANGUAGE_PATTERN % "Course" + ASSERTION_ERROR_LANGUAGE_PATTERN % "Course" ) self.assertEqual( self.course_resp_contains_korean_with_diff_settings()[1], expected_result[1], - ASSERSION_ERROR_CONTENT_LANGUAGE_PATTERN % "Course" + ASSERTION_ERROR_CONTENT_LANGUAGE_PATTERN % "Course" ) def set_course_lang_to_ko(self): @@ -423,7 +423,7 @@ def verify_result_with_configure(self, my_site_name): self.assertTrue(resp.status_code, 200) self.assertEqual(len(mail.outbox), 1) - # In the view, tranlating RELATE for email title. + # In the view, translating RELATE for email title. self.assertEqual( self.get_translation_count( mock_gettext_auth, my_site_name), 1) @@ -459,8 +459,8 @@ def test_exceptions(self): RELATE_MAINTENANCE_MODE=True, RELATE_MAINTENANCE_MODE_EXCEPTIONS=[ "192.168.1.1", "127.0.0.1"]): - mata = self.request.META - mata["REMOTE_ADDR"] = "192.168.1.1" + meta = self.request.META + meta["REMOTE_ADDR"] = "192.168.1.1" self.assertFalse(is_maintenance_mode(self.request)) self.client.get("/") diff --git a/tests/test_pages/test_base.py b/tests/test_pages/test_base.py index 5354c30c9..dc5321f00 100644 --- a/tests/test_pages/test_base.py +++ b/tests/test_pages/test_base.py @@ -434,7 +434,7 @@ def test_deprecated_make_page_data_has_warning(self): self.assertTrue(mock_warn.call_count >= 1) expected_warn_msg = ( - "TextQuestion is using the make_page_data compatiblity " + "TextQuestion is using the make_page_data compatibility " "hook, which is deprecated.") warned_with_expected_msg = False @@ -513,7 +513,7 @@ def test_update_grade_data_from_grading_form(self): expected_warn_msg = ( "HumanGradedTextQuestion is using the " "update_grade_data_from_grading_form " - "compatiblity hook, which is deprecated.") + "compatibility hook, which is deprecated.") warned_with_expected_msg = False @@ -545,7 +545,7 @@ def test_post_form_deprecated(self): self.assertTrue(mock_warn.call_count >= 1) expected_warn_msg = ( - "TextQuestion is using the post_form compatiblity hook, " + "TextQuestion is using the post_form compatibility hook, " "which is deprecated.") warned_with_expected_msg = False diff --git a/tests/test_pages/test_choice.py b/tests/test_pages/test_choice.py index 0f26cffd1..88a5df921 100644 --- a/tests/test_pages/test_choice.py +++ b/tests/test_pages/test_choice.py @@ -705,7 +705,7 @@ def test_broken_page_data_permutation_set_changed(self): class MarkupToHtmlPlainTest(unittest.TestCase): # test course.page.choice.markup_to_html_plain - def test_markup_to_html_plain_wrapp_by_p_tag(self): + def test_markup_to_html_plain_wrap_by_p_tag(self): with mock.patch("course.page.choice.markup_to_html") as mock_mth: mock_mth.side_effect = lambda x, y: "

%s

" % y fake_page_context = object @@ -713,7 +713,7 @@ def test_markup_to_html_plain_wrapp_by_p_tag(self): markup_to_html_plain(fake_page_context, "abcd"), "abcd") self.assertEqual(markup_to_html_plain(fake_page_context, ""), "") - def test_markup_to_html_plain_wrapp_by_p_other_tag(self): + def test_markup_to_html_plain_wrap_by_p_other_tag(self): with mock.patch("course.page.choice.markup_to_html") as mock_mth: mock_mth.side_effect = lambda x, y: "
%s
" % y fake_page_context = object diff --git a/tests/test_pages/test_code.py b/tests/test_pages/test_code.py index 90ce648a5..4159ea88a 100644 --- a/tests/test_pages/test_code.py +++ b/tests/test_pages/test_code.py @@ -50,11 +50,11 @@ NOT_ALLOW_MULTIPLE_SUBMISSION_WARNING = ( "code question does not explicitly " "allow multiple submission. Either add " - "access_rules/add_permssions/change_answer " + "access_rules/add_permissions/change_answer " "or add 'single_submission: True' to confirm that you intend " "for only a single submission to be allowed. " "While you're at it, consider adding " - "access_rules/add_permssions/see_correctness." + "access_rules/add_permissions/see_correctness." ) MAX_AUTO_FEEDBACK_POINTS_VALICATION_ERROR_MSG_PATTERN = ( @@ -271,7 +271,7 @@ def test_allow_multiple_submit(self): self.assertSandboxHasValidPage(resp) self.assertSandboxWarningTextContain(resp, None) - def test_explicity_not_allow_multiple_submit(self): + def test_explicitly_not_allow_multiple_submit(self): markdown = ( markdowns.CODE_MARKDWON_PATTERN_EXPLICITLY_NOT_ALLOW_MULTI_SUBMIT % {"extra_data_file": ""} @@ -630,10 +630,10 @@ def test_figures(self): "2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmq" "srO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T" "19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xA" - "C1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQp" + "C1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQp" # spellchecker: disable-line # noqa: E501 "GhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdIS" "UpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeY" - "mZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+T" + "mZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+T" # spellchecker: disable-line # noqa: E501 "l5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/AP38ooooA//Z") png_b64 = ( "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACAQMAAAB" @@ -1007,7 +1007,7 @@ def test_no_traceback(self): result = {"result": "uncaught_error"} self.assertFalse(is_nuisance_failure(result)) - def test_traceback_unkown(self): + def test_traceback_unknown(self): result = {"result": "uncaught_error", "traceback": "unknow traceback"} self.assertFalse(is_nuisance_failure(result)) diff --git a/tests/test_pages/test_text.py b/tests/test_pages/test_text.py index 0d0c1a188..401186f65 100644 --- a/tests/test_pages/test_text.py +++ b/tests/test_pages/test_text.py @@ -147,7 +147,7 @@ class TextAnswerFormTest(unittest.TestCase): def test_unknown_widget_type(self): - self.assertEqual(TextAnswerForm.get_text_widget("unkown"), (None, None)) + self.assertEqual(TextAnswerForm.get_text_widget("unknown"), (None, None)) def test_validation_error(self): class SomeValidator1: diff --git a/tests/test_tasks.py b/tests/test_tasks.py index 52c9335f7..69bb80e2c 100644 --- a/tests/test_tasks.py +++ b/tests/test_tasks.py @@ -530,13 +530,13 @@ def setUp(self): super().setUp() # {{{ create flow page visits - # all 40, null answer 25, answerd 15 + # all 40, null answer 25, answered 15 result1 = self.create_flow_page_visit(self.course1) (self.course1_n_all_fpv, self.course1_n_null_answer_fpv, self.course1_n_non_null_answer_fpv) = result1 - # all 30, null answer 24, answerd 6 + # all 30, null answer 24, answered 6 result2 = self.create_flow_page_visit( self.course2, n_participations_per_course=3, n_sessions_per_participation=2, diff --git a/tests/test_utils.py b/tests/test_utils.py index ebb8ac595..81e3bd25a 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -574,7 +574,7 @@ class GetFlowRulesTest(SingleCourseTestMixin, TestCase): def test_no_rules(self): - # emtpy rules + # empty rules flow_desc = self.get_hacked_flow_desc(del_rules=True) default_rules_desc = [mock.MagicMock(), mock.MagicMock()] diff --git a/tests/test_validation/test_validation_tools.py b/tests/test_validation/test_validation_tools.py index 7437cd762..008836ce9 100644 --- a/tests/test_validation/test_validation_tools.py +++ b/tests/test_validation/test_validation_tools.py @@ -2696,12 +2696,12 @@ class CheckGradeIdentifierLinkTest( def setUpTestData(cls): super().setUpTestData() - cls.default_grade_indentifier = "gopp1" + cls.default_grade_identifier = "gopp1" cls.course1 = factories.CourseFactory(identifier="test-course1") cls.course2 = factories.CourseFactory(identifier="test-course2") cls.course1_gopp = factories.GradingOpportunityFactory( - course=cls.course1, identifier=cls.default_grade_indentifier, + course=cls.course1, identifier=cls.default_grade_identifier, flow_id="flow1_id") # Ensure cross gopp independence @@ -2711,13 +2711,13 @@ def setUpTestData(cls): # Ensure cross course independence factories.GradingOpportunityFactory( - course=cls.course2, identifier=cls.default_grade_indentifier, + course=cls.course2, identifier=cls.default_grade_identifier, flow_id="flow2_id") def test_success(self): validation.check_grade_identifier_link( vctx, location, self.course1, flow_id="flow1_id", - flow_grade_identifier=self.default_grade_indentifier) + flow_grade_identifier=self.default_grade_identifier) def test_fail(self): new_flow_id = "flow2_id" diff --git a/tests/test_versioning.py b/tests/test_versioning.py index d549589fb..620d3e80d 100644 --- a/tests/test_versioning.py +++ b/tests/test_versioning.py @@ -649,8 +649,8 @@ def test_auth_instructor(self): FAILURE_MSG = "my validation error." LOCATION1 = "location1" LOCATION2 = "location2" -WARNING1 = "some waring1" -WARNING2 = "some waring2" +WARNING1 = "some warning1" +WARNING2 = "some warning2" @pytest.mark.django_db @@ -660,7 +660,7 @@ class RunCourseUpdateCommandTest(MockAddMessageMixing, unittest.TestCase): default_preview_sha = "preview_sha" default_old_sha = "old_sha" default_switch_to_sha = "switch_sha" - default_lastest_sha = "latest_sha" + default_latest_sha = "latest_sha" def setUp(self): super().setUp() @@ -898,7 +898,7 @@ def test_end_preview(self): def test_fetch_not_prevent_discarding_revisions(self): self.mock_client.fetch.return_value = FetchPackResult( - refs={b"HEAD": self.default_lastest_sha.encode()}, + refs={b"HEAD": self.default_latest_sha.encode()}, symrefs={}, agent="Git") @@ -907,7 +907,7 @@ def test_fetch_not_prevent_discarding_revisions(self): self.default_old_sha), ("fetch_update", 3, [FETCHED_LITERAL, UPDATE_APPLIED_LITERAL, VALIDATE_SUCCESS_LITERAL], [], - self.default_lastest_sha) + self.default_latest_sha) ) for (command, add_message_call_count, expected, not_expected, @@ -953,7 +953,7 @@ def test_internal_git_repo_more_commits(self): def test_fetch_update_success_with_warnings(self): self.mock_client.fetch.return_value = FetchPackResult( - refs={b"HEAD": self.default_lastest_sha.encode()}, + refs={b"HEAD": self.default_latest_sha.encode()}, symrefs={}, agent="Git") self.mock_validate_course_content.return_value = ( @@ -971,11 +971,11 @@ def test_fetch_update_success_with_warnings(self): not_expected_add_message_literals=[PREVIEW_END_LITERAL]) self.assertIsNone(self.participation.preview_git_commit_sha) self.assertEqual( - self.course.active_git_commit_sha, self.default_lastest_sha) + self.course.active_git_commit_sha, self.default_latest_sha) def test_fetch_update_success_with_warnings_previewing(self): self.mock_client.fetch.return_value = FetchPackResult( - refs={b"HEAD": self.default_lastest_sha.encode()}, + refs={b"HEAD": self.default_latest_sha.encode()}, symrefs={}, agent="Git") @@ -995,7 +995,7 @@ def test_fetch_update_success_with_warnings_previewing(self): ]) self.assertIsNone(self.participation.preview_git_commit_sha) self.assertEqual( - self.course.active_git_commit_sha, self.default_lastest_sha) + self.course.active_git_commit_sha, self.default_latest_sha) def test_fetch_update_with_validation_error(self): from course.validation import ValidationError @@ -1050,7 +1050,7 @@ def test_update_with_validation_error_previewing(self): def test_fetch_not_may_update(self): self.mock_client.fetch.return_value = FetchPackResult( - refs={b"HEAD": self.default_lastest_sha.encode()}, + refs={b"HEAD": self.default_latest_sha.encode()}, symrefs={}, agent="Git") @@ -1217,7 +1217,7 @@ def test_no_permission(self): self.assertEqual(resp.status_code, 403) def test_participation_with_preview_permission(self): - # Just to make sure it won't fail, Todo: assersion on form kwargs + # Just to make sure it won't fail, Todo: assertion on form kwargs from course.models import ParticipationPermission pp = ParticipationPermission( participation=self.student_participation, @@ -1233,7 +1233,7 @@ def test_participation_with_preview_permission(self): self.assertEqual(resp.status_code, 200, command) def test_participation_with_update_permission(self): - # Just to make sure it won't fail, Todo: assersion on form kwargs + # Just to make sure it won't fail, Todo: assertion on form kwargs from course.models import ParticipationPermission pp = ParticipationPermission( participation=self.student_participation,