Python Requirements Update (#29516)

* chore: Updating Python Requirements

* fix: fix pylint issues

Co-authored-by: Mohammad Ahtasham ul Hassan <mohammad.ahtasham@arbisoft.com>
This commit is contained in:
edX requirements bot
2021-12-08 04:13:27 -05:00
committed by GitHub
parent 5d5a11fc16
commit bb20b17428
37 changed files with 100 additions and 100 deletions

View File

@@ -605,7 +605,7 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
enrollment = CourseEnrollmentFactory(course_id=self.course.id)
student = enrollment.user
outbox = self.get_outbox()
assert outbox == []
assert not outbox
url = reverse(
view_name,
@@ -687,7 +687,7 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
enrollment = CourseEnrollmentFactory(course_id=course_key)
student = enrollment.user
outbox = self.get_outbox()
assert outbox == []
assert not outbox
url = reverse(
view_name,
@@ -729,7 +729,7 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
ccx = self.make_ccx()
course_key = CCXLocator.from_course_locator(self.course.id, ccx.id)
outbox = self.get_outbox()
assert outbox == []
assert not outbox
url = reverse(
view_name,
@@ -777,7 +777,7 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
course_key = CCXLocator.from_course_locator(course.id, ccx.id)
outbox = self.get_outbox()
CourseEnrollmentAllowed(course_id=course_key, email=identifier)
assert outbox == []
assert not outbox
url = reverse(
view_name,

View File

@@ -515,7 +515,7 @@ class CertificateGetTests(SharedModuleStoreTestCase):
"""
Test the case when there are no certificates for a user.
"""
assert get_certificates_for_user(self.student_no_cert.username) == []
assert not get_certificates_for_user(self.student_no_cert.username)
@patch.dict(settings.FEATURES, {'CERTIFICATES_HTML_VIEW': True})
def test_get_web_certificate_url(self):

View File

@@ -79,7 +79,7 @@ class mock_ecommerce_api_endpoint:
if self.expect_called is None:
called_if_expected = True
else:
called_if_expected = self.expect_called == (httpretty.last_request().headers != {})
called_if_expected = self.expect_called == (bool(httpretty.last_request().headers))
httpretty.disable()
if self.reset_on_exit:

View File

@@ -139,7 +139,7 @@ class CoursesTest(ModuleStoreTestCase):
# Request filtering for an org distinct from the designated org.
no_courses = get_courses(user, org=primary)
assert list(no_courses) == []
assert not list(no_courses)
# Request filtering for an org matching the designated org.
site_courses = get_courses(user, org=alternate)

View File

@@ -173,7 +173,7 @@ def preprocess_collection(user, course, collection):
model.update(update)
usage_id = model["usage_id"]
if usage_id in list(cache.keys()):
if usage_id in list(cache.keys()): # lint-amnesty, pylint: disable=consider-iterating-dictionary
model.update(cache[usage_id])
filtered_collection.append(model)
continue
@@ -202,7 +202,7 @@ def preprocess_collection(user, course, collection):
if not section:
log.debug("Section not found: %s", usage_key)
continue
if section.location in list(cache.keys()):
if section.location in list(cache.keys()): # lint-amnesty, pylint: disable=consider-iterating-dictionary
usage_context = cache[section.location]
usage_context.update({
"unit": get_module_context(course, unit),
@@ -216,7 +216,7 @@ def preprocess_collection(user, course, collection):
if not chapter:
log.debug("Chapter not found: %s", usage_key)
continue
if chapter.location in list(cache.keys()):
if chapter.location in list(cache.keys()): # lint-amnesty, pylint: disable=consider-iterating-dictionary
usage_context = cache[chapter.location]
usage_context.update({
"unit": get_module_context(course, unit),
@@ -349,7 +349,7 @@ def get_notes(request, course, page=DEFAULT_PAGE, page_size=DEFAULT_PAGE_SIZE, t
# Verify response dict structure
expected_keys = ['total', 'rows', 'num_pages', 'start', 'next', 'previous', 'current_page']
keys = list(collection.keys())
keys = list(collection.keys()) # lint-amnesty, pylint: disable=consider-iterating-dictionary
if not keys or not all(key in expected_keys for key in keys):
log.error("Incorrect data received from notes api: collection_data=%s", str(collection))
raise EdxNotesParseError(_("Incorrect data received from notes api."))

View File

@@ -63,7 +63,7 @@ class ExperimentUtilsTests(ModuleStoreTestCase, TestCase):
def test_unenrolled_courses_for_empty_courses(self):
unenrolled_courses = get_unenrolled_courses([], [])
assert [] == unenrolled_courses
assert not unenrolled_courses
def test_unenrolled_courses_for_single_course(self):
course = {'key': 'UQx+ENGY1x'}

View File

@@ -279,7 +279,7 @@ class TestGradeIteration(SharedModuleStoreTestCase):
iterator, but it shouldn't error.
"""
grade_results = list(CourseGradeFactory().iter([], self.course))
assert grade_results == []
assert not grade_results
def test_all_empty_grades(self):
"""

View File

@@ -70,8 +70,8 @@ class TestAnalyticsFormatDictlist(TestCase):
def test_format_dictlist_empty(self):
header, datarows = format_dictlist([], [])
assert header == []
assert datarows == []
assert not header
assert not datarows
def test_create_csv_response(self):
header = ['Name', 'Email']

View File

@@ -314,7 +314,7 @@ class TestLinkProgramEnrollments(TestLinkProgramEnrollmentsMixin, TestCase):
}
)
assert errors == {}
assert not errors
self._assert_program_enrollment(self.user_2, self.program, '0001')
self._assert_no_program_enrollment(self.user_1, self.program)
# assert that all of user_1's course enrollments as part of the program

View File

@@ -77,7 +77,7 @@ def validate_and_link_program_enrollments(program_uuid_string, linkage_text):
(item.get('external_key') or '').strip(): (item['username'] or '').strip()
for item in reader
}
if not (all(ext_key_to_username.keys()) and all(ext_key_to_username.values())):
if not (all(ext_key_to_username.keys()) and all(ext_key_to_username.values())): # lint-amnesty, pylint: disable=consider-iterating-dictionary
return [], [
"All linking lines must be in the format 'external_user_key,lms_username'"
]
@@ -87,7 +87,7 @@ def validate_and_link_program_enrollments(program_uuid_string, linkage_text):
successes = [
str(item)
for item in ext_key_to_username.items()
if item[0] not in link_errors.keys()
if item[0] not in link_errors.keys() # lint-amnesty, pylint: disable=consider-iterating-dictionary
]
errors = [message for message in link_errors.values()] # lint-amnesty, pylint: disable=unnecessary-comprehension
return successes, errors

View File

@@ -906,7 +906,7 @@ class TestPayAndVerifyView(UrlResetMixin, ModuleStoreTestCase, XssTestMixin, Tes
# ensure the mock api call was made. NOTE: the following line
# approximates the check - if the headers were empty it means
# there was no last request.
assert httpretty.last_request().headers != {}
assert httpretty.last_request().headers
return response
def _assert_displayed_mode(self, response, expected_mode):