Skip to content

Commit

Permalink
Flake8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbaldwin committed Jul 15, 2020
1 parent 533da01 commit c533043
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions figures/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def filter_only_completed(self, queryset, name, value): # pylint: disable=unuse
"""
The "value" parameter is either `True` or `False`
"""
if value == True:
if value is True:
return queryset.filter(sections_possible__gt=0,
sections_worked=F('sections_possible'))
else:
Expand All @@ -179,7 +179,7 @@ def filter_exclude_completed(self, queryset, name, value): # pylint: disable=un
"""
The "value" parameter is either `True` or `False`
"""
if value == True:
if value is True:
# This is a hack until we add `completed` field to LCGM
return queryset.filter(sections_worked__lt=F('sections_possible'))
else:
Expand Down
16 changes: 7 additions & 9 deletions tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import pytest
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
from django.db.models import F
from django.test import TestCase

from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
Expand Down Expand Up @@ -105,7 +104,6 @@ def test_filter_course_id(self):
course_id = CourseEnrollment.objects.all()[0].course_id
expected_results = CourseEnrollment.objects.filter(course_id=course_id)
assert expected_results.count() != len(self.course_enrollments)
f = CourseEnrollmentFilter(queryset=expected_results)

res = CourseEnrollmentFilter().filter_course_id(
queryset=CourseEnrollment.objects.all(),
Expand Down Expand Up @@ -313,21 +311,21 @@ def test_filter_only_completed_no_value(self):
qs = self.filter.filter_only_completed(queryset=self.site_qs,
name='only_completed',
value=False)
assert qs ==self.site_qs
assert qs == self.site_qs

def test_filter_exclude_completed(self):
qs = self.filter.filter_exclude_completed(queryset=self.site_qs,
name='exclude_completed',
value=True)
name='exclude_completed',
value=True)
assert qs.count() == 1 and qs[0] == self.not_complete

def test_filter_only_completed_no_value(self):
def test_filter_only_excluded_no_value(self):
"""Test that the method returns the queryset passed in
"""
qs = self.filter.filter_exclude_completed(queryset=self.site_qs,
name='exclude_completed',
value=False)
assert qs ==self.site_qs
name='exclude_completed',
value=False)
assert qs == self.site_qs


@pytest.mark.skipif(django_filters_pre_v1(),
Expand Down

0 comments on commit c533043

Please sign in to comment.