Fix pep8 issues caused by the fixer.
This commit is contained in:
@@ -105,8 +105,7 @@ class TestGitExport(CourseTestCase):
|
||||
with self.assertRaisesRegex(GitExportError, six.text_type(GitExportError.URL_BAD)):
|
||||
git_export_utils.export_to_git(course_key, 'example.com:edx/notreal')
|
||||
|
||||
with self.assertRaisesRegex(GitExportError,
|
||||
six.text_type(GitExportError.URL_NO_AUTH)):
|
||||
with self.assertRaisesRegex(GitExportError, six.text_type(GitExportError.URL_NO_AUTH)):
|
||||
git_export_utils.export_to_git(course_key, 'http://blah')
|
||||
|
||||
def test_bad_git_repos(self):
|
||||
@@ -117,23 +116,20 @@ class TestGitExport(CourseTestCase):
|
||||
self.assertFalse(os.path.isdir(test_repo_path))
|
||||
course_key = CourseLocator('foo', 'blah', '100-')
|
||||
# Test bad clones
|
||||
with self.assertRaisesRegex(GitExportError,
|
||||
six.text_type(GitExportError.CANNOT_PULL)):
|
||||
with self.assertRaisesRegex(GitExportError, six.text_type(GitExportError.CANNOT_PULL)):
|
||||
git_export_utils.export_to_git(
|
||||
course_key,
|
||||
'https://user:blah@example.com/test_repo.git')
|
||||
self.assertFalse(os.path.isdir(test_repo_path))
|
||||
|
||||
# Setup good repo with bad course to test xml export
|
||||
with self.assertRaisesRegex(GitExportError,
|
||||
six.text_type(GitExportError.XML_EXPORT_FAIL)):
|
||||
with self.assertRaisesRegex(GitExportError, six.text_type(GitExportError.XML_EXPORT_FAIL)):
|
||||
git_export_utils.export_to_git(
|
||||
course_key,
|
||||
'file://{0}'.format(self.bare_repo_dir))
|
||||
|
||||
# Test bad git remote after successful clone
|
||||
with self.assertRaisesRegex(GitExportError,
|
||||
six.text_type(GitExportError.CANNOT_PULL)):
|
||||
with self.assertRaisesRegex(GitExportError, six.text_type(GitExportError.CANNOT_PULL)):
|
||||
git_export_utils.export_to_git(
|
||||
course_key,
|
||||
'https://user:blah@example.com/r.git')
|
||||
@@ -189,7 +185,6 @@ class TestGitExport(CourseTestCase):
|
||||
'file://{0}'.format(self.bare_repo_dir)
|
||||
)
|
||||
|
||||
with self.assertRaisesRegex(GitExportError,
|
||||
six.text_type(GitExportError.CANNOT_COMMIT)):
|
||||
with self.assertRaisesRegex(GitExportError, six.text_type(GitExportError.CANNOT_COMMIT)):
|
||||
git_export_utils.export_to_git(
|
||||
self.course.id, 'file://{0}'.format(self.bare_repo_dir))
|
||||
|
||||
@@ -28,7 +28,7 @@ class LMSLinksTestCase(TestCase):
|
||||
location = course_key.make_usage_key('vertical', 'contacting_us')
|
||||
link = utils.get_lms_link_for_item(location, False)
|
||||
self.assertEqual(link, "//localhost:8000/courses/course-v1:mitX+101+test/jump_to/block-v1:mitX+101+test+type"
|
||||
"@vertical+block@contacting_us")
|
||||
"@vertical+block@contacting_us")
|
||||
|
||||
# test preview
|
||||
link = utils.get_lms_link_for_item(location, True)
|
||||
@@ -42,7 +42,7 @@ class LMSLinksTestCase(TestCase):
|
||||
location = course_key.make_usage_key('course', 'test')
|
||||
link = utils.get_lms_link_for_item(location)
|
||||
self.assertEqual(link, "//localhost:8000/courses/course-v1:mitX+101+test/jump_to/block-v1:mitX+101+test+type"
|
||||
"@course+block@test")
|
||||
"@course+block@test")
|
||||
|
||||
def lms_link_for_certificate_web_view_test(self):
|
||||
""" Tests get_lms_link_for_certificate_web_view. """
|
||||
|
||||
@@ -2194,7 +2194,7 @@ class TestComponentHandler(TestCase):
|
||||
self.descriptor.handle = create_response
|
||||
|
||||
self.assertEqual(component_handler(self.request, self.usage_key_string, 'dummy_handler').status_code,
|
||||
status_code)
|
||||
status_code)
|
||||
|
||||
@ddt.data((True, True), (False, False),)
|
||||
@ddt.unpack
|
||||
|
||||
@@ -481,13 +481,13 @@ class FormulaResponseTest(ResponseTest):
|
||||
input_dict = {'1_2_1': "x + 2*y + y"}
|
||||
correct_map = problem.grade_answers(input_dict)
|
||||
self.assertEqual(correct_map.get_hint('1_2_1'),
|
||||
'Check the coefficient of y')
|
||||
'Check the coefficient of y')
|
||||
|
||||
# Expect to receive a hint if we leave out x
|
||||
input_dict = {'1_2_1': "2*y"}
|
||||
correct_map = problem.grade_answers(input_dict)
|
||||
self.assertEqual(correct_map.get_hint('1_2_1'),
|
||||
'Try including the variable x')
|
||||
'Try including the variable x')
|
||||
|
||||
def test_script(self):
|
||||
"""
|
||||
@@ -819,13 +819,13 @@ class StringResponseTest(ResponseTest): # pylint: disable=missing-docstring
|
||||
input_dict = {'1_2_1': 'Wisconsin'}
|
||||
correct_map = problem.grade_answers(input_dict)
|
||||
self.assertEqual(correct_map.get_hint('1_2_1'),
|
||||
"The state capital of Wisconsin is Madison")
|
||||
"The state capital of Wisconsin is Madison")
|
||||
|
||||
# We should get a hint for Minnesota
|
||||
input_dict = {'1_2_1': 'Minnesota'}
|
||||
correct_map = problem.grade_answers(input_dict)
|
||||
self.assertEqual(correct_map.get_hint('1_2_1'),
|
||||
"The state capital of Minnesota is St. Paul")
|
||||
"The state capital of Minnesota is St. Paul")
|
||||
|
||||
# We should NOT get a hint for Michigan (the correct answer)
|
||||
input_dict = {'1_2_1': 'Michigan'}
|
||||
@@ -868,13 +868,13 @@ class StringResponseTest(ResponseTest): # pylint: disable=missing-docstring
|
||||
input_dict = {'1_2_1': 'Wisconsin'}
|
||||
correct_map = problem.grade_answers(input_dict)
|
||||
self.assertEqual(correct_map.get_hint('1_2_1'),
|
||||
"The state capital of Wisconsin is Madison")
|
||||
"The state capital of Wisconsin is Madison")
|
||||
|
||||
# We should get a hint for Minnesota
|
||||
input_dict = {'1_2_1': 'Minnesota'}
|
||||
correct_map = problem.grade_answers(input_dict)
|
||||
self.assertEqual(correct_map.get_hint('1_2_1'),
|
||||
"The state capital of Minnesota is St. Paul")
|
||||
"The state capital of Minnesota is St. Paul")
|
||||
|
||||
# We should NOT get a hint for Michigan (the correct answer)
|
||||
input_dict = {'1_2_1': 'Michigan'}
|
||||
|
||||
@@ -279,7 +279,7 @@ class CapaShuffleTest(unittest.TestCase):
|
||||
html = orig_html.replace('\n', ' ') # avoid headaches with .* matching
|
||||
print(html)
|
||||
self.assertRegex(html, r"<div>.*\[.*'Banana'.*'Apple'.*'Chocolate'.*'Donut'.*\].*</div>.*" +
|
||||
r"<div>.*\[.*'C'.*'A'.*'D'.*'B'.*\].*</div>")
|
||||
r"<div>.*\[.*'C'.*'A'.*'D'.*'B'.*\].*</div>")
|
||||
# Look at the responses in their authored order
|
||||
responses = sorted(list(problem.responders.values()), key=lambda resp: int(resp.id[resp.id.rindex('_') + 1:]))
|
||||
self.assertFalse(responses[0].has_mask())
|
||||
|
||||
@@ -130,7 +130,7 @@ class CapaTargetedFeedbackTest(unittest.TestCase):
|
||||
without_new_lines = the_html.replace("\\n", "").replace("\n", "")
|
||||
# pylint: disable=line-too-long
|
||||
self.assertRegex(without_new_lines,
|
||||
r"<targetedfeedback explanation-id=\"feedbackC\" role=\"group\" aria-describedby=\"1_2_1-legend\">\s*<span class=\"sr\">Correct</span>.*Feedback on your correct solution...")
|
||||
r"<targetedfeedback explanation-id=\"feedbackC\" role=\"group\" aria-describedby=\"1_2_1-legend\">\s*<span class=\"sr\">Correct</span>.*Feedback on your correct solution...")
|
||||
self.assertNotRegexpMatches(without_new_lines, r"feedback1|feedback2|feedback3")
|
||||
|
||||
def test_targeted_feedback_id_typos(self):
|
||||
|
||||
@@ -595,7 +595,7 @@ class TestEmailSendFromDashboardMockedHtmlToText(EmailSendFromDashboardTestCase)
|
||||
self.assertEqual(json.loads(response.content.decode('utf-8')), self.success_content)
|
||||
|
||||
self.assertEqual(mock_factory.emails_sent,
|
||||
1 + len(self.staff) + len(self.students) + LARGE_NUM_EMAILS - len(optouts))
|
||||
1 + len(self.staff) + len(self.students) + LARGE_NUM_EMAILS - len(optouts))
|
||||
outbox_contents = [e.to[0] for e in mail.outbox]
|
||||
should_send_contents = ([self.instructor.email] +
|
||||
[s.email for s in self.staff] +
|
||||
@@ -668,14 +668,14 @@ class TestCourseEmailContext(SharedModuleStoreTestCase):
|
||||
self.assertEqual(email_context['platform_name'], settings.PLATFORM_NAME)
|
||||
self.assertEqual(email_context['course_title'], self.course_title)
|
||||
self.assertEqual(email_context['course_url'],
|
||||
'{}://edx.org/courses/{}/{}/{}/'.format(scheme,
|
||||
self.course_org,
|
||||
self.course_number,
|
||||
self.course_run))
|
||||
'{}://edx.org/courses/{}/{}/{}/'.format(scheme,
|
||||
self.course_org,
|
||||
self.course_number,
|
||||
self.course_run))
|
||||
self.assertEqual(email_context['course_image_url'],
|
||||
'{}://edx.org/c4x/{}/{}/asset/images_course_image.jpg'.format(scheme,
|
||||
self.course_org,
|
||||
self.course_number))
|
||||
'{}://edx.org/c4x/{}/{}/asset/images_course_image.jpg'.format(scheme,
|
||||
self.course_org,
|
||||
self.course_number))
|
||||
self.assertEqual(email_context['email_settings_url'], '{}://edx.org/dashboard'.format(scheme))
|
||||
self.assertEqual(email_context['account_settings_url'], '{}://edx.org/account/settings'.format(scheme))
|
||||
|
||||
|
||||
@@ -962,7 +962,7 @@ class TestCertificatesInstructorApiBulkWhiteListExceptions(SharedModuleStoreTest
|
||||
data = json.loads(response.content.decode('utf-8'))
|
||||
self.assertNotEqual(len(data['general_errors']), 0)
|
||||
self.assertEqual(data['general_errors'][0], 'Make sure that the file you upload is in CSV format with '
|
||||
'no extraneous characters or rows.')
|
||||
'no extraneous characters or rows.')
|
||||
|
||||
def test_bad_file_upload_type(self):
|
||||
"""
|
||||
|
||||
@@ -455,8 +455,8 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT
|
||||
response = self.client.get(self.url)
|
||||
|
||||
self.assertEqual(expected_result,
|
||||
'CCX Coaches are able to create their own Custom Courses based on this course'
|
||||
in response.content.decode('utf-8'))
|
||||
'CCX Coaches are able to create their own Custom Courses based on this course'
|
||||
in response.content.decode('utf-8'))
|
||||
|
||||
def test_grade_cutoffs(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user