From eef964f5f6d31bdc49f3da826708e7c2499480ab Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 31 Jul 2016 10:17:59 -0400 Subject: [PATCH] Fix unused-variable errors --- .../contentstore/features/course-settings.py | 2 +- .../contentstore/features/course-updates.py | 2 +- cms/djangoapps/contentstore/features/grading.py | 4 ++-- common/djangoapps/enrollment/tests/test_views.py | 4 ++-- .../management/commands/create_random_users.py | 2 +- .../student/management/commands/get_grades.py | 2 +- .../student/tests/test_create_account.py | 2 +- .../student/tests/test_recent_enrollments.py | 2 +- common/djangoapps/terrain/stubs/comments.py | 2 +- common/djangoapps/util/tests/test_db.py | 4 ++-- common/lib/capa/capa/inputtypes.py | 2 +- .../lib/capa/capa/tests/response_xml_factory.py | 1 - common/lib/capa/capa/tests/test_inputtypes.py | 1 - common/lib/xmodule/xmodule/capa_module.py | 2 +- common/lib/xmodule/xmodule/html_checker.py | 2 +- .../test_split_modulestore_bulk_operations.py | 2 +- .../xmodule/xmodule/tests/test_capa_module.py | 2 +- .../tests/discussion/test_discussion.py | 4 ++-- .../acceptance/tests/lms/test_learner_profile.py | 16 ++++++++-------- lms/djangoapps/courseware/tests/test_views.py | 2 +- lms/djangoapps/debug/views.py | 2 +- lms/djangoapps/discussion_api/api.py | 2 -- lms/djangoapps/notes/tests.py | 4 ++-- lms/djangoapps/shoppingcart/models.py | 2 +- .../shoppingcart/tests/test_reports.py | 16 +++------------- .../student_account/test/test_views.py | 2 +- .../verify_student/tests/test_models.py | 4 ++-- .../verify_student/tests/test_views.py | 2 +- .../user_api/preferences/tests/test_api.py | 3 --- 29 files changed, 40 insertions(+), 57 deletions(-) diff --git a/cms/djangoapps/contentstore/features/course-settings.py b/cms/djangoapps/contentstore/features/course-settings.py index 669d76c248..df44ef9917 100644 --- a/cms/djangoapps/contentstore/features/course-settings.py +++ b/cms/djangoapps/contentstore/features/course-settings.py @@ -3,7 +3,7 @@ from lettuce import world, step from selenium.webdriver.common.keys import Keys -from common import type_in_codemirror +from cms.djangoapps.contentstore.features.common import type_in_codemirror from django.conf import settings from nose.tools import assert_true, assert_false diff --git a/cms/djangoapps/contentstore/features/course-updates.py b/cms/djangoapps/contentstore/features/course-updates.py index 90db6bbd53..1b50910a65 100644 --- a/cms/djangoapps/contentstore/features/course-updates.py +++ b/cms/djangoapps/contentstore/features/course-updates.py @@ -73,7 +73,7 @@ def change_date(_step, new_date): world.css_click(button_css) date_css = 'input.date' date = world.css_find(date_css) - for i in range(len(date.value)): + for __ in range(len(date.value)): date._element.send_keys(Keys.END, Keys.BACK_SPACE) date._element.send_keys(new_date) save_css = '.save-button' diff --git a/cms/djangoapps/contentstore/features/grading.py b/cms/djangoapps/contentstore/features/grading.py index 7f9b315ce0..1ed6855389 100644 --- a/cms/djangoapps/contentstore/features/grading.py +++ b/cms/djangoapps/contentstore/features/grading.py @@ -19,7 +19,7 @@ def view_grading_settings(step): @step(u'I add "([^"]*)" new grade') def add_grade(step, many): grade_css = '.new-grade-button' - for i in range(int(many)): + for __ in range(int(many)): world.css_click(grade_css) @@ -120,7 +120,7 @@ def set_weight(step, weight): weight_id = '#course-grading-assignment-gradeweight' weight_field = world.css_find(weight_id)[-1] old_weight = world.css_value(weight_id, -1) - for count in range(len(old_weight)): + for __ in range(len(old_weight)): weight_field._element.send_keys(Keys.END, Keys.BACK_SPACE) weight_field._element.send_keys(weight) diff --git a/common/djangoapps/enrollment/tests/test_views.py b/common/djangoapps/enrollment/tests/test_views.py index b9e5a30340..9a8add5fbf 100644 --- a/common/djangoapps/enrollment/tests/test_views.py +++ b/common/djangoapps/enrollment/tests/test_views.py @@ -152,7 +152,7 @@ class EnrollmentTest(EnrollmentTestMixin, ModuleStoreTestCase, APITestCase): self.rate_limit_config.save() throttle = EnrollmentUserThrottle() - self.rate_limit, rate_duration = throttle.parse_rate(throttle.rate) + self.rate_limit, __ = throttle.parse_rate(throttle.rate) # Pass emit_signals when creating the course so it would be cached # as a CourseOverview. @@ -543,7 +543,7 @@ class EnrollmentTest(EnrollmentTestMixin, ModuleStoreTestCase, APITestCase): mode_display_name=CourseMode.DEFAULT_MODE_SLUG, ) - for attempt in xrange(self.rate_limit + 10): + for __ in xrange(self.rate_limit + 10): self.assert_enrollment_status(as_server=True) def test_create_enrollment_with_mode(self): diff --git a/common/djangoapps/student/management/commands/create_random_users.py b/common/djangoapps/student/management/commands/create_random_users.py index ba44c58020..b8929679a2 100644 --- a/common/djangoapps/student/management/commands/create_random_users.py +++ b/common/djangoapps/student/management/commands/create_random_users.py @@ -30,7 +30,7 @@ def make_random_form(): def create(num, course_key): """Create num users, enrolling them in course_key if it's not None""" - for idx in range(num): + for __ in range(num): (user, _, _) = _do_create_account(make_random_form()) if course_key is not None: CourseEnrollment.enroll(user, course_key) diff --git a/common/djangoapps/student/management/commands/get_grades.py b/common/djangoapps/student/management/commands/get_grades.py index 3759eaf575..2e207de2a6 100644 --- a/common/djangoapps/student/management/commands/get_grades.py +++ b/common/djangoapps/student/management/commands/get_grades.py @@ -113,7 +113,7 @@ class Command(BaseCommand): diff = datetime.datetime.now() - start timeleft = diff * (total - count) / STATUS_INTERVAL hours, remainder = divmod(timeleft.seconds, 3600) - minutes, seconds = divmod(remainder, 60) + minutes, __ = divmod(remainder, 60) print "{0}/{1} completed ~{2:02}:{3:02}m remaining".format( count, total, hours, minutes) start = datetime.datetime.now() diff --git a/common/djangoapps/student/tests/test_create_account.py b/common/djangoapps/student/tests/test_create_account.py index d7277b82fd..7a2958d440 100644 --- a/common/djangoapps/student/tests/test_create_account.py +++ b/common/djangoapps/student/tests/test_create_account.py @@ -601,7 +601,7 @@ class TestCreateCommentsServiceUser(TransactionTestCase): def test_cs_user_not_created(self, register, request): "If user account creation fails, we should not create a comments service user" try: - response = self.client.post(self.url, self.params) + self.client.post(self.url, self.params) except: pass with self.assertRaises(User.DoesNotExist): diff --git a/common/djangoapps/student/tests/test_recent_enrollments.py b/common/djangoapps/student/tests/test_recent_enrollments.py index 59db47ae65..4aa01451ab 100644 --- a/common/djangoapps/student/tests/test_recent_enrollments.py +++ b/common/djangoapps/student/tests/test_recent_enrollments.py @@ -40,7 +40,7 @@ class TestRecentEnrollments(ModuleStoreTestCase, XssTestMixin): # Old Course old_course_location = locator.CourseLocator('Org0', 'Course0', 'Run0') - course, enrollment = self._create_course_and_enrollment(old_course_location) + __, enrollment = self._create_course_and_enrollment(old_course_location) enrollment.created = datetime.datetime(1900, 12, 31, 0, 0, 0, 0) enrollment.save() diff --git a/common/djangoapps/terrain/stubs/comments.py b/common/djangoapps/terrain/stubs/comments.py index 208604e4e8..38e7efdf53 100644 --- a/common/djangoapps/terrain/stubs/comments.py +++ b/common/djangoapps/terrain/stubs/comments.py @@ -106,7 +106,7 @@ class StubCommentsServiceHandler(StubHttpRequestHandler): def do_threads(self): threads = self.server.config.get('threads', {}) - threads_data = [val for key, val in threads.items()] + threads_data = threads.values() self.send_json_response({"collection": threads_data, "page": 1, "num_pages": 1}) def do_search_threads(self): diff --git a/common/djangoapps/util/tests/test_db.py b/common/djangoapps/util/tests/test_db.py index 03038697ae..cca0911948 100644 --- a/common/djangoapps/util/tests/test_db.py +++ b/common/djangoapps/util/tests/test_db.py @@ -194,7 +194,7 @@ class GenerateIntIdTestCase(TestCase): """ minimum = 1 maximum = times - for i in range(times): + for __ in range(times): self.assertIn(generate_int_id(minimum, maximum), range(minimum, maximum + 1)) @ddt.data(10) @@ -206,7 +206,7 @@ class GenerateIntIdTestCase(TestCase): minimum = 1 maximum = times used_ids = {2, 4, 6, 8} - for i in range(times): + for __ in range(times): int_id = generate_int_id(minimum, maximum, used_ids) self.assertIn(int_id, list(set(range(minimum, maximum + 1)) - used_ids)) diff --git a/common/lib/capa/capa/inputtypes.py b/common/lib/capa/capa/inputtypes.py index cb36e35721..238b111a22 100644 --- a/common/lib/capa/capa/inputtypes.py +++ b/common/lib/capa/capa/inputtypes.py @@ -1289,7 +1289,7 @@ class FormulaEquationInput(InputTypeBase): # At some point, we might want to mark invalid variables as red # or something, and this is where we would need to pass those in. result['preview'] = latex_preview(formula) - except pyparsing.ParseException as err: + except pyparsing.ParseException: result['error'] = _("Sorry, couldn't parse formula") result['formula'] = formula except Exception: diff --git a/common/lib/capa/capa/tests/response_xml_factory.py b/common/lib/capa/capa/tests/response_xml_factory.py index fc2b84159f..20081b9536 100644 --- a/common/lib/capa/capa/tests/response_xml_factory.py +++ b/common/lib/capa/capa/tests/response_xml_factory.py @@ -515,7 +515,6 @@ class FormulaResponseXMLFactory(ResponseXMLFactory): # "x,y,z@4,5,3:10,12,8#4" means plug in values for (x,y,z) # from within the box defined by points (4,5,3) and (10,12,8) # The "#4" means to repeat 4 times. - variables = [str(v) for v in sample_dict.keys()] low_range_vals = [str(f[0]) for f in sample_dict.values()] high_range_vals = [str(f[1]) for f in sample_dict.values()] sample_str = ( diff --git a/common/lib/capa/capa/tests/test_inputtypes.py b/common/lib/capa/capa/tests/test_inputtypes.py index edc336246e..2fea231c6f 100644 --- a/common/lib/capa/capa/tests/test_inputtypes.py +++ b/common/lib/capa/capa/tests/test_inputtypes.py @@ -358,7 +358,6 @@ class CodeInputTest(unittest.TestCase): element = etree.fromstring(xml_str) escapedict = {'"': '"'} - esc = lambda s: saxutils.escape(s, escapedict) state = {'value': 'print "good evening"', 'status': 'incomplete', diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 9343673e4e..5fc906e9eb 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -108,7 +108,7 @@ class CapaModule(CapaMixin, XModule): _, _, traceback_obj = sys.exc_info() # pylint: disable=redefined-outer-name raise ProcessingError(not_found_error_message), None, traceback_obj - except Exception as err: + except Exception: log.exception( "Unknown error when dispatching %s to %s for user %s", dispatch, diff --git a/common/lib/xmodule/xmodule/html_checker.py b/common/lib/xmodule/xmodule/html_checker.py index b30e5163a2..76c53a1591 100644 --- a/common/lib/xmodule/xmodule/html_checker.py +++ b/common/lib/xmodule/xmodule/html_checker.py @@ -10,6 +10,6 @@ def check_html(html): try: etree.fromstring(html, parser) return True - except Exception as err: + except Exception: # pylint: disable=broad-except pass return False diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore_bulk_operations.py b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore_bulk_operations.py index 2de4d4d3d4..a19c9f0494 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore_bulk_operations.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore_bulk_operations.py @@ -422,7 +422,7 @@ class TestBulkWriteMixinFindMethods(TestBulkWriteMixin): db_definitions = [db_definition(_id) for _id in db_ids if _id not in active_ids] self.bulk._begin_bulk_operation(self.course_key) - for n, _id in enumerate(active_ids): + for _id in active_ids: self.bulk.update_definition(self.course_key, active_definition(_id)) self.conn.get_definitions.return_value = db_definitions diff --git a/common/lib/xmodule/xmodule/tests/test_capa_module.py b/common/lib/xmodule/xmodule/tests/test_capa_module.py index afa2454af3..c8425fd2fb 100644 --- a/common/lib/xmodule/xmodule/tests/test_capa_module.py +++ b/common/lib/xmodule/xmodule/tests/test_capa_module.py @@ -1479,7 +1479,7 @@ class CapaModuleTest(unittest.TestCase): of the form test_func() -> bool ''' success = False - for i in range(num_tries): + for __ in range(num_tries): if test_func() is True: success = True break diff --git a/common/test/acceptance/tests/discussion/test_discussion.py b/common/test/acceptance/tests/discussion/test_discussion.py index aa11cfa86f..28f4f2d0f1 100644 --- a/common/test/acceptance/tests/discussion/test_discussion.py +++ b/common/test/acceptance/tests/discussion/test_discussion.py @@ -1072,14 +1072,14 @@ class DiscussionUserProfileTest(UniqueCourseTest): self.assertFalse(page.is_next_button_shown()) # click all the way up through each page - for i in range(current_page, total_pages): + for __ in range(current_page, total_pages): _check_page() if current_page < total_pages: page.click_on_page(current_page + 1) current_page += 1 # click all the way back down - for i in range(current_page, 0, -1): + for __ in range(current_page, 0, -1): _check_page() if current_page > 1: page.click_on_page(current_page - 1) diff --git a/common/test/acceptance/tests/lms/test_learner_profile.py b/common/test/acceptance/tests/lms/test_learner_profile.py index 0c24cbe4cb..7b18ced3c4 100644 --- a/common/test/acceptance/tests/lms/test_learner_profile.py +++ b/common/test/acceptance/tests/lms/test_learner_profile.py @@ -209,7 +209,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): When I go to my profile page. Then I see that the profile visibility is set to public. """ - username, user_id = self.log_in_as_unique_user() + username, __ = self.log_in_as_unique_user() profile_page = self.visit_profile_page(username) self.verify_profile_page_is_public(profile_page) @@ -277,7 +277,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): When I click on Profile link. Then I will be navigated to Profile page. """ - username, user_id = self.log_in_as_unique_user() + username, __ = self.log_in_as_unique_user() dashboard_page = DashboardPage(self.browser) dashboard_page.visit() dashboard_page.click_username_dropdown() @@ -362,7 +362,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): Then `country` field mode should be `edit` And `country` field icon should be visible. """ - username, user_id = self.log_in_as_unique_user() + username, __ = self.log_in_as_unique_user() profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC) self._test_dropdown_field(profile_page, 'country', 'Pakistan', 'Pakistan', 'display') @@ -390,7 +390,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): Then `language` field mode should be `edit` And `language` field icon should be visible. """ - username, user_id = self.log_in_as_unique_user() + username, __ = self.log_in_as_unique_user() profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC) self._test_dropdown_field(profile_page, 'language_proficiencies', 'Urdu', 'Urdu', 'display') self._test_dropdown_field(profile_page, 'language_proficiencies', '', 'Add language', 'placeholder') @@ -427,7 +427,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): "why you're taking courses, or what you hope to learn." ) - username, user_id = self.log_in_as_unique_user() + username, __ = self.log_in_as_unique_user() profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC) self._test_textarea_field(profile_page, 'bio', 'ThisIsIt', 'ThisIsIt', 'display') self._test_textarea_field(profile_page, 'bio', '', placeholder_value, 'placeholder') @@ -478,7 +478,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): And i cannot upload/remove the image. """ year_of_birth = datetime.now().year - 5 - username, user_id = self.log_in_as_unique_user() + username, __ = self.log_in_as_unique_user() profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PRIVATE) self.verify_profile_forced_private_message( @@ -499,7 +499,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): Then i can see the upload/remove image text And i am able to upload new image """ - username, user_id = self.log_in_as_unique_user() + username, __ = self.log_in_as_unique_user() profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC) self.assert_default_image_has_public_access(profile_page) @@ -664,7 +664,7 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): Then i can see only the upload image text And i cannot see the remove image text """ - username, user_id = self.log_in_as_unique_user() + username, __ = self.log_in_as_unique_user() profile_page = self.visit_profile_page(username, privacy=self.PRIVACY_PUBLIC) self.assert_default_image_has_public_access(profile_page) diff --git a/lms/djangoapps/courseware/tests/test_views.py b/lms/djangoapps/courseware/tests/test_views.py index c96a809e1f..b67f9a4163 100644 --- a/lms/djangoapps/courseware/tests/test_views.py +++ b/lms/djangoapps/courseware/tests/test_views.py @@ -826,7 +826,7 @@ class ViewsTestCase(ModuleStoreTestCase, MilestonesTestCaseMixin): response = self._submit_financial_assistance_form(data) self.assertEqual(response.status_code, 204) - __, ___, ticket_subject, ticket_body, tags, additional_info = mock_record_feedback.call_args[0] + __, __, ticket_subject, __, tags, additional_info = mock_record_feedback.call_args[0] mocked_kwargs = mock_record_feedback.call_args[1] group_name = mocked_kwargs['group_name'] require_update = mocked_kwargs['require_update'] diff --git a/lms/djangoapps/debug/views.py b/lms/djangoapps/debug/views.py index 6a75a45fbc..c8036b34e6 100644 --- a/lms/djangoapps/debug/views.py +++ b/lms/djangoapps/debug/views.py @@ -27,7 +27,7 @@ def run_python(request): g = {} try: safe_exec(py_code, g) - except Exception as e: + except Exception: # pylint: disable=broad-except c['results'] = traceback.format_exc() else: c['results'] = pprint.pformat(g) diff --git a/lms/djangoapps/discussion_api/api.py b/lms/djangoapps/discussion_api/api.py index 6d11d47d0c..511c44b253 100644 --- a/lms/djangoapps/discussion_api/api.py +++ b/lms/djangoapps/discussion_api/api.py @@ -542,8 +542,6 @@ def get_thread_list( "sort_order": order_direction, } - text_search_rewrite = None - if view: if view in ["unread", "unanswered"]: query_params[view] = "true" diff --git a/lms/djangoapps/notes/tests.py b/lms/djangoapps/notes/tests.py index 75f0d2bdd3..cd9ffb82eb 100644 --- a/lms/djangoapps/notes/tests.py +++ b/lms/djangoapps/notes/tests.py @@ -142,7 +142,7 @@ class ApiTest(TestCase): def create_notes(self, num_notes, create=True): notes = [] - for n in range(num_notes): + for __ in range(num_notes): note = models.Note(**self.note) if create: note.save() @@ -437,7 +437,7 @@ class NoteTest(TestCase): note.clean(json.dumps({ 'text': 'foo', 'quote': 'bar', - 'ranges': [{} for i in range(10)] # too many ranges + 'ranges': [{} for __ in range(10)] # too many ranges })) def test_as_dict(self): diff --git a/lms/djangoapps/shoppingcart/models.py b/lms/djangoapps/shoppingcart/models.py index 8fb22c590d..b2cb541f8a 100644 --- a/lms/djangoapps/shoppingcart/models.py +++ b/lms/djangoapps/shoppingcart/models.py @@ -1577,7 +1577,7 @@ class PaidCourseRegistration(OrderItem): super(PaidCourseRegistration, cls).add_to_order(order, course_id, cost, currency=currency) - item, created = cls.objects.get_or_create(order=order, user=order.user, course_id=course_id) + item, __ = cls.objects.get_or_create(order=order, user=order.user, course_id=course_id) item.status = order.status item.mode = course_mode.slug item.qty = 1 diff --git a/lms/djangoapps/shoppingcart/tests/test_reports.py b/lms/djangoapps/shoppingcart/tests/test_reports.py index dccb1aa9e2..4d7d0230f1 100644 --- a/lms/djangoapps/shoppingcart/tests/test_reports.py +++ b/lms/djangoapps/shoppingcart/tests/test_reports.py @@ -120,10 +120,7 @@ class ReportTypeTests(ModuleStoreTestCase): refunded_certs = report.rows() # check that we have the right number - num_certs = 0 - for cert in refunded_certs: - num_certs += 1 - self.assertEqual(num_certs, 2) + self.assertEqual(len(list(refunded_certs)), 2) self.assertTrue(CertificateItem.objects.get(user=self.first_refund_user, course_id=self.course_key)) self.assertTrue(CertificateItem.objects.get(user=self.second_refund_user, course_id=self.course_key)) @@ -210,18 +207,11 @@ class ItemizedPurchaseReportTest(ModuleStoreTestCase): purchases = report.rows() # since there's not many purchases, just run through the generator to make sure we've got the right number - num_purchases = 0 - for item in purchases: - num_purchases += 1 - self.assertEqual(num_purchases, 2) + self.assertEqual(len(list(purchases)), 2) report = initialize_report("itemized_purchase_report", self.now + self.FIVE_MINS, self.now + self.FIVE_MINS + self.FIVE_MINS) no_purchases = report.rows() - - num_purchases = 0 - for item in no_purchases: - num_purchases += 1 - self.assertEqual(num_purchases, 0) + self.assertEqual(len(list(no_purchases)), 0) def test_purchased_csv(self): """ diff --git a/lms/djangoapps/student_account/test/test_views.py b/lms/djangoapps/student_account/test/test_views.py index 3612568187..ae710ef36d 100644 --- a/lms/djangoapps/student_account/test/test_views.py +++ b/lms/djangoapps/student_account/test/test_views.py @@ -193,7 +193,7 @@ class StudentAccountUpdateTest(CacheIsolationTestCase, UrlResetMixin): self.client.logout() # Make many consecutive bad requests in an attempt to trigger the rate limiter - for attempt in xrange(self.INVALID_ATTEMPTS): + for __ in xrange(self.INVALID_ATTEMPTS): self._change_password(email=self.NEW_EMAIL) response = self._change_password(email=self.NEW_EMAIL) diff --git a/lms/djangoapps/verify_student/tests/test_models.py b/lms/djangoapps/verify_student/tests/test_models.py index c6a57efccf..96778e1b45 100644 --- a/lms/djangoapps/verify_student/tests/test_models.py +++ b/lms/djangoapps/verify_student/tests/test_models.py @@ -71,8 +71,8 @@ def mock_software_secure_post(url, headers=None, data=None, **kwargs): ) # The keys should be stored as Base64 strings, i.e. this should not explode - photo_id_key = data_dict["PhotoIDKey"].decode("base64") - user_photo_key = data_dict["UserPhotoKey"].decode("base64") + data_dict["PhotoIDKey"].decode("base64") + data_dict["UserPhotoKey"].decode("base64") response = requests.Response() response.status_code = 200 diff --git a/lms/djangoapps/verify_student/tests/test_views.py b/lms/djangoapps/verify_student/tests/test_views.py index 2044fab825..092c7bcd2b 100644 --- a/lms/djangoapps/verify_student/tests/test_views.py +++ b/lms/djangoapps/verify_student/tests/test_views.py @@ -83,7 +83,7 @@ class StartView(TestCase): Test the case where the user has no pending `PhotoVerificationAttempts`, but is just starting their first. """ - user = UserFactory.create(username="rusty", password="test") + UserFactory.create(username="rusty", password="test") self.client.login(username="rusty", password="test") def must_be_logged_in(self): diff --git a/openedx/core/djangoapps/user_api/preferences/tests/test_api.py b/openedx/core/djangoapps/user_api/preferences/tests/test_api.py index 54417642cb..1fc1277a3f 100644 --- a/openedx/core/djangoapps/user_api/preferences/tests/test_api.py +++ b/openedx/core/djangoapps/user_api/preferences/tests/test_api.py @@ -180,9 +180,6 @@ class TestPreferenceAPI(TestCase): """ Verifies the basic behavior of update_user_preferences. """ - expected_user_preferences = { - self.test_preference_key: "new_value", - } set_user_preference(self.user, self.test_preference_key, "new_value") self.assertEqual( get_user_preference(self.user, self.test_preference_key),