pyupgrade on lms gating and grades apps (#26532)

This commit is contained in:
M. Zulqarnain
2021-02-22 12:58:41 +05:00
committed by GitHub
parent 36748ff78f
commit e505d99237
73 changed files with 726 additions and 816 deletions

View File

@@ -3,10 +3,11 @@ Unit tests for gating.signals module
"""
from unittest.mock import Mock, patch
from ddt import data, ddt, unpack
from milestones import api as milestones_api
from milestones.tests.utils import MilestonesTestCaseMixin
from mock import Mock, patch
from lms.djangoapps.courseware.tests.helpers import LoginEnrollmentTestCase
from lms.djangoapps.gating.api import evaluate_prerequisite
@@ -25,7 +26,7 @@ class GatingTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Initial data setup
"""
super(GatingTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
super().setUp()
# create course
self.course = CourseFactory.create(
@@ -65,7 +66,7 @@ class TestEvaluatePrerequisite(GatingTestCase, MilestonesTestCaseMixin):
"""
def setUp(self):
super(TestEvaluatePrerequisite, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
super().setUp()
self.user_dict = {'id': self.user.id}
self.prereq_milestone = None
self.subsection_grade = Mock(location=self.seq1.location, percent_graded=0.5)

View File

@@ -11,12 +11,12 @@ from edx_toggles.toggles.testutils import override_waffle_switch
from milestones import api as milestones_api
from milestones.tests.utils import MilestonesTestCaseMixin
from common.djangoapps.student.tests.factories import UserFactory
from lms.djangoapps.courseware.access import has_access
from lms.djangoapps.grades.api import CourseGradeFactory
from lms.djangoapps.grades.tests.utils import answer_problem
from openedx.core.djangolib.testing.utils import get_mock_request
from openedx.core.lib.gating import api as gating_api
from common.djangoapps.student.tests.factories import UserFactory
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
@@ -31,11 +31,11 @@ class TestGatedContent(MilestonesTestCaseMixin, SharedModuleStoreTestCase):
@classmethod
def setUpClass(cls):
super(TestGatedContent, cls).setUpClass()
super().setUpClass()
cls.set_up_course()
def setUp(self):
super(TestGatedContent, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
super().setUp()
self.setup_gating_milestone(50, 100)
self.non_staff_user = UserFactory()
self.staff_user = UserFactory(is_staff=True, is_superuser=True)

View File

@@ -3,10 +3,10 @@ Unit tests for gating.signals module
"""
from mock import Mock, patch
from unittest.mock import Mock, patch
from lms.djangoapps.gating.signals import evaluate_subsection_gated_milestones
from common.djangoapps.student.tests.factories import UserFactory
from lms.djangoapps.gating.signals import evaluate_subsection_gated_milestones
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@@ -18,7 +18,7 @@ class TestHandleScoreChanged(ModuleStoreTestCase):
"""
def setUp(self):
super(TestHandleScoreChanged, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
super().setUp()
self.course = CourseFactory.create(org='TestX', number='TS01', run='2016_Q1')
self.user = UserFactory.create()
self.subsection_grade = Mock()