Use ==/!= to compare str, bytes, and int literals

This commit is contained in:
cclauss
2019-03-19 21:40:06 +01:00
parent 581a6a725a
commit bb31716c97
6 changed files with 7 additions and 7 deletions

View File

@@ -294,7 +294,7 @@ class PaginationTestCase(AssetsTestCase):
assets_response = json_response['assets']
self.assertEquals(filter_value_split, json_response['assetTypes'])
if filter_value is not '':
if filter_value != '':
content_types = [asset['content_type'].lower()
for asset in assets_response]
if 'OTHER' in filter_value_split:

View File

@@ -7,7 +7,7 @@ from django.db import migrations, models
def add_default_enable(apps, schema_editor):
ForumsConfig = apps.get_model("django_comment_common", "ForumsConfig")
settings_count = ForumsConfig.objects.count()
if settings_count is 0:
if settings_count == 0:
# By default we want the comment client enabled, but this is *not* enabling
# discussions themselves by default, as in showing the Disucussions tab, or
# inline discussions, etc. It just allows the underlying service client to work.

View File

@@ -634,12 +634,12 @@ def click_tools():
@world.absorb
def is_mac():
return platform.mac_ver()[0] is not ''
return platform.mac_ver()[0] != ''
@world.absorb
def is_firefox():
return world.browser.driver_name is 'Firefox'
return world.browser.driver_name == 'Firefox'
@world.absorb

View File

@@ -48,7 +48,7 @@ class Date(JSONField):
"""
if field is None:
return field
elif field is "":
elif field == "":
return None
elif isinstance(field, basestring):
return self._parse_date_wo_default_month_day(field)

View File

@@ -156,7 +156,7 @@ class CourseGradeFactory(object):
course_data,
persistent_grade.percent_grade,
persistent_grade.letter_grade,
persistent_grade.letter_grade is not u''
persistent_grade.letter_grade != u''
)
@staticmethod

View File

@@ -198,7 +198,7 @@ class FormatInterpolateVisitor(BaseVisitor):
node: The AST root node.
"""
if isinstance(node.func, ast.Attribute) and node.func.attr is 'format':
if isinstance(node.func, ast.Attribute) and node.func.attr == 'format':
if self.format_caller_node is None:
# Store the caller, or left-hand-side node of the initial
# format() call.