From 33d1dc2eeb5db83f07b6b7fbf3b10ef01b74702b Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Wed, 16 Apr 2014 16:49:37 -0400 Subject: [PATCH] [1.7.x] Fixed flake8 warnings introduced in recent commits. Backport of 79f05616fbf48cf7c205ef17666af0c3d47b3c1e from master --- django/db/backends/postgresql_psycopg2/base.py | 2 -- tests/prefetch_related/tests.py | 2 +- tests/test_discovery_sample/doctests.py | 3 ++- tests/test_runner/test_discover_runner.py | 1 - 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py index c2aa486b74..cc44075ba7 100644 --- a/django/db/backends/postgresql_psycopg2/base.py +++ b/django/db/backends/postgresql_psycopg2/base.py @@ -4,8 +4,6 @@ PostgreSQL database backend for Django. Requires psycopg 2: http://initd.org/projects/psycopg2 """ -import sys - from django.conf import settings from django.db.backends import (BaseDatabaseFeatures, BaseDatabaseWrapper, BaseDatabaseValidation) diff --git a/tests/prefetch_related/tests.py b/tests/prefetch_related/tests.py index 765223b71d..239e5747f6 100644 --- a/tests/prefetch_related/tests.py +++ b/tests/prefetch_related/tests.py @@ -1066,7 +1066,7 @@ class Ticket21760Tests(TestCase): for _ in range(3): house = House.objects.create() for _ in range(3): - self.rooms.append(Room.objects.create(house = house)) + self.rooms.append(Room.objects.create(house=house)) #@override_settings(DEBUG=True) def test_bug(self): diff --git a/tests/test_discovery_sample/doctests.py b/tests/test_discovery_sample/doctests.py index 3d228c6efb..4cc2a2105b 100644 --- a/tests/test_discovery_sample/doctests.py +++ b/tests/test_discovery_sample/doctests.py @@ -3,6 +3,7 @@ Doctest example from the official Python documentation. https://docs.python.org/3/library/doctest.html """ + def factorial(n): """Return the factorial of n, an exact integer >= 0. @@ -35,7 +36,7 @@ def factorial(n): raise ValueError("n must be >= 0") if math.floor(n) != n: raise ValueError("n must be exact integer") - if n+1 == n: # catch a value like 1e300 + if n + 1 == n: # catch a value like 1e300 raise OverflowError("n too large") result = 1 factor = 2 diff --git a/tests/test_runner/test_discover_runner.py b/tests/test_runner/test_discover_runner.py index 809d4e16e9..975819508d 100644 --- a/tests/test_runner/test_discover_runner.py +++ b/tests/test_runner/test_discover_runner.py @@ -105,7 +105,6 @@ class DiscoverRunnerTest(TestCase): def test_testcase_ordering(self): suite = DiscoverRunner().build_suite(["test_discovery_sample/"]) - tc_names = [case.__class__.__name__ for case in suite._tests] self.assertEqual( suite._tests[0].__class__.__name__, 'TestDjangoTestCase',