refactor: ran pyupgrade on openedx/core/djangoapps
ran pyupgrade on openedx/core/djangoapps/{schedules, self_paced, service_status}
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import django.utils.timezone
|
||||
import model_utils.fields
|
||||
from django.db import migrations, models
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
@@ -15,7 +12,7 @@ class Migration(migrations.Migration):
|
||||
name='ScheduleExperience',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('experience_type', models.PositiveSmallIntegerField(default=0, choices=[(0, u'Recurring Nudge and Upgrade Reminder'), (1, u'Course Updates')])),
|
||||
('experience_type', models.PositiveSmallIntegerField(default=0, choices=[(0, 'Recurring Nudge and Upgrade Reminder'), (1, 'Course Updates')])),
|
||||
('schedule', models.OneToOneField(related_name='experience', to='schedules.Schedule', on_delete=models.CASCADE)),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.26 on 2019-11-21 18:00
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.26 on 2019-11-24 20:52
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.26 on 2019-12-18 16:18
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.28 on 2020-02-28 20:18
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.28 on 2020-03-02 19:14
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.28 on 2020-03-03 18:36
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.28 on 2020-03-09 17:02
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.28 on 2020-03-04 21:49
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.27 on 2020-01-07 18:46
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.28 on 2020-03-12 20:29
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.28 on 2020-03-16 14:00
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.28 on 2020-03-16 19:35
|
||||
|
||||
|
||||
|
||||
@@ -12,14 +12,14 @@ from common.djangoapps.student.tests.factories import CourseEnrollmentFactory
|
||||
|
||||
|
||||
class ScheduleExperienceFactory(factory.DjangoModelFactory):
|
||||
class Meta(object):
|
||||
class Meta:
|
||||
model = models.ScheduleExperience
|
||||
|
||||
experience_type = models.ScheduleExperience.EXPERIENCES.default
|
||||
|
||||
|
||||
class ScheduleFactory(factory.DjangoModelFactory): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
class Meta(object):
|
||||
class Meta:
|
||||
model = models.Schedule
|
||||
|
||||
start_date = factory.Faker('future_datetime', tzinfo=pytz.UTC)
|
||||
@@ -29,7 +29,7 @@ class ScheduleFactory(factory.DjangoModelFactory): # lint-amnesty, pylint: disa
|
||||
|
||||
|
||||
class ScheduleConfigFactory(factory.DjangoModelFactory): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
class Meta(object):
|
||||
class Meta:
|
||||
model = models.ScheduleConfig
|
||||
|
||||
site = factory.SubFactory(SiteFactory)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring
|
||||
|
||||
import datetime
|
||||
from unittest.mock import patch
|
||||
import pytest
|
||||
@@ -85,8 +83,8 @@ class TestContentHighlights(ModuleStoreTestCase): # lint-amnesty, pylint: disab
|
||||
|
||||
def test_course_with_no_highlights(self):
|
||||
with self.store.bulk_operations(self.course_key):
|
||||
self._create_chapter(display_name=u"Week 1")
|
||||
self._create_chapter(display_name=u"Week 2")
|
||||
self._create_chapter(display_name="Week 1")
|
||||
self._create_chapter(display_name="Week 2")
|
||||
|
||||
self.course = self.store.get_course(self.course_key) # lint-amnesty, pylint: disable=attribute-defined-outside-init
|
||||
assert len(self.course.get_children()) == 2
|
||||
@@ -158,7 +156,7 @@ class TestContentHighlights(ModuleStoreTestCase): # lint-amnesty, pylint: disab
|
||||
assert get_next_section_highlights(self.user, self.course_key, two_days_ago, three_days.date()) == (None, None)
|
||||
assert get_next_section_highlights(self.user, self.course_key, two_days_ago, four_days.date()) ==\
|
||||
(['final week!'], 4)
|
||||
exception_message = 'Last section was reached. There are no more highlights for {}'.format(self.course_key)
|
||||
exception_message = f'Last section was reached. There are no more highlights for {self.course_key}'
|
||||
with pytest.raises(CourseUpdateDoesNotExist):
|
||||
get_next_section_highlights(self.user, self.course_key, two_days_ago, six_days.date())
|
||||
|
||||
|
||||
@@ -87,9 +87,9 @@ class TestBinnedSchedulesBaseResolver(SchedulesResolverTestMixin, TestCase):
|
||||
|
||||
@ddt.unpack
|
||||
@ddt.data(
|
||||
(None, set([])),
|
||||
('course1', set(['course1'])),
|
||||
(['course1', 'course2'], set(['course1', 'course2']))
|
||||
(None, set()),
|
||||
('course1', {'course1'}),
|
||||
(['course1', 'course2'], {'course1', 'course2'})
|
||||
)
|
||||
def test_get_course_org_filter_exclude__in(self, course_org_filter, expected_org_list):
|
||||
SiteConfigurationFactory.create(
|
||||
@@ -168,7 +168,7 @@ class TestCourseUpdateResolver(SchedulesResolverTestMixin, ModuleStoreTestCase):
|
||||
'contact_mailing_address': '123 Sesame Street',
|
||||
'course_ids': [str(self.course.id)],
|
||||
'course_name': self.course.display_name,
|
||||
'course_url': '/courses/{}/course/'.format(self.course.id),
|
||||
'course_url': f'/courses/{self.course.id}/course/',
|
||||
'dashboard_url': '/dashboard',
|
||||
'homepage_url': '/',
|
||||
'mobile_store_urls': {},
|
||||
@@ -257,7 +257,7 @@ class TestCourseNextSectionUpdateResolver(SchedulesResolverTestMixin, ModuleStor
|
||||
'contact_mailing_address': '123 Sesame Street',
|
||||
'course_ids': [str(self.course.id)],
|
||||
'course_name': self.course.display_name,
|
||||
'course_url': '/courses/{}/course/'.format(self.course.id),
|
||||
'course_url': f'/courses/{self.course.id}/course/',
|
||||
'dashboard_url': '/dashboard',
|
||||
'homepage_url': '/',
|
||||
'mobile_store_urls': {},
|
||||
|
||||
@@ -4,10 +4,10 @@ Tests for schedules signals
|
||||
|
||||
|
||||
import datetime
|
||||
from unittest.mock import patch
|
||||
|
||||
import ddt
|
||||
import pytest
|
||||
from mock import patch
|
||||
from pytz import utc
|
||||
|
||||
from common.djangoapps.course_modes.models import CourseMode
|
||||
@@ -99,7 +99,7 @@ class UpdateScheduleTests(SharedModuleStoreTestCase): # lint-amnesty, pylint: d
|
||||
VERIFICATION_DEADLINE_DAYS = 14
|
||||
|
||||
def setUp(self):
|
||||
super(UpdateScheduleTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
super().setUp()
|
||||
self.site = SiteFactory.create()
|
||||
ScheduleConfigFactory.create(site=self.site)
|
||||
DynamicUpgradeDeadlineConfiguration.objects.create(enabled=True, deadline_days=self.VERIFICATION_DEADLINE_DAYS)
|
||||
|
||||
@@ -5,10 +5,10 @@ Tests for schedules tasks
|
||||
|
||||
import datetime
|
||||
from unittest import skipUnless
|
||||
from unittest.mock import DEFAULT, Mock, patch
|
||||
|
||||
import ddt
|
||||
from django.conf import settings
|
||||
from mock import DEFAULT, Mock, patch
|
||||
|
||||
from openedx.core.djangoapps.schedules.resolvers import DEFAULT_NUM_BINS
|
||||
from openedx.core.djangoapps.schedules.tasks import BinnedScheduleMessageBaseTask
|
||||
@@ -23,7 +23,7 @@ from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_un
|
||||
"Can't test schedules if the app isn't installed")
|
||||
class TestBinnedScheduleMessageBaseTask(CacheIsolationTestCase): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
def setUp(self):
|
||||
super(TestBinnedScheduleMessageBaseTask, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
super().setUp()
|
||||
|
||||
self.site = SiteFactory.create()
|
||||
self.schedule_config = ScheduleConfigFactory.create(site=self.site)
|
||||
@@ -43,7 +43,7 @@ class TestBinnedScheduleMessageBaseTask(CacheIsolationTestCase): # lint-amnesty
|
||||
day_offset=2
|
||||
)
|
||||
patches['log_info'].assert_called_once_with(
|
||||
u'Message queuing disabled for site %s', self.site.domain)
|
||||
'Message queuing disabled for site %s', self.site.domain)
|
||||
send.apply_async.assert_not_called()
|
||||
|
||||
@ddt.data(0, 2, -3)
|
||||
@@ -64,7 +64,7 @@ class TestBinnedScheduleMessageBaseTask(CacheIsolationTestCase): # lint-amnesty
|
||||
target_date = current_date.replace(hour=0, minute=0, second=0, microsecond=0) + \
|
||||
datetime.timedelta(day_offset)
|
||||
patches['log_info'].assert_any_call(
|
||||
u'Target date = %s', target_date.isoformat())
|
||||
'Target date = %s', target_date.isoformat())
|
||||
assert send.call_count == DEFAULT_NUM_BINS
|
||||
|
||||
@ddt.data(True, False)
|
||||
|
||||
Reference in New Issue
Block a user