diff --git a/datatableview/tests/test_datatables.py b/datatableview/tests/test_datatables.py index ba69f37..d4ac262 100644 --- a/datatableview/tests/test_datatables.py +++ b/datatableview/tests/test_datatables.py @@ -47,7 +47,7 @@ class NoError(BaseException): pass with self.assertRaises(NoError): - dt = DT([], "/") + DT([], "/") raise NoError() def test_column_names_list_raises_related_columns(self): @@ -74,7 +74,7 @@ class NoError(BaseException): pass with self.assertRaises(NoError): - dt = DT([], "/") + DT([], "/") raise NoError() def test_get_ordering_splits(self): @@ -148,7 +148,7 @@ def test_get_records_populates_cache(self): def test_populate_records_searches(self): obj1 = ExampleModel.objects.create(name="test name 1", value=False) - obj2 = ExampleModel.objects.create(name="test name 2", value=True) + ExampleModel.objects.create(name="test name 2", value=True) queryset = ExampleModel.objects.all() class DT(Datatable): @@ -195,7 +195,7 @@ class Meta: self.assertEqual(list(dt._records), [obj2, obj1]) def test_populate_records_avoids_column_callbacks(self): - obj1 = ExampleModel.objects.create(name="test name 1") + ExampleModel.objects.create(name="test name 1") queryset = ExampleModel.objects.all() class DT(Datatable): @@ -211,7 +211,7 @@ def preload_record_data(self, obj): raise def test_preload_record_data_calls_view(self): - obj1 = ExampleModel.objects.create(name="test name 1") + ExampleModel.objects.create(name="test name 1") queryset = ExampleModel.objects.all() class Dummy(object): @@ -453,7 +453,7 @@ def test_get_object_pk(self): def test_get_extra_record_data_passes_through_to_object_serialization(self): obj1 = ExampleModel.objects.create(name="test name 1") - queryset = ExampleModel.objects.all() + ExampleModel.objects.all() class DT(Datatable): def get_extra_record_data(self, obj): @@ -466,7 +466,7 @@ def get_extra_record_data(self, obj): self.assertEqual(data["_extra_data"]["custom"], "data") def test_get_extra_record_data_passes_through_to_json_response(self): - obj1 = ExampleModel.objects.create(name="test name 1") + ExampleModel.objects.create(name="test name 1") queryset = ExampleModel.objects.all() class DT(Datatable): @@ -672,9 +672,9 @@ class Meta: self.assertEqual(list(dt._records), []) def test_search_term_boolean(self): - obj1 = ExampleModel.objects.create(name="test name 1", value=True) - obj2 = ExampleModel.objects.create(name="test name 2", value=True) - obj3 = ExampleModel.objects.create(name="test name 12", value=False) + ExampleModel.objects.create(name="test name 1", value=True) + ExampleModel.objects.create(name="test name 2", value=True) + ExampleModel.objects.create(name="test name 12", value=False) queryset = ExampleModel.objects.all() class DT(Datatable): diff --git a/datatableview/tests/test_helpers.py b/datatableview/tests/test_helpers.py index 754c140..ec50689 100644 --- a/datatableview/tests/test_helpers.py +++ b/datatableview/tests/test_helpers.py @@ -113,7 +113,7 @@ def test_through_filter(self): """Verifies that through_filter works.""" helper = helpers.through_filter - target_function = lambda data, arg=None: (data, arg) + target_function = lambda data, arg=None: (data, arg) # noqa:E731 # Verify simple use data = "Data string" diff --git a/datatableview/tests/test_views.py b/datatableview/tests/test_views.py index 23947a4..9eefae0 100644 --- a/datatableview/tests/test_views.py +++ b/datatableview/tests/test_views.py @@ -135,40 +135,40 @@ def test_column_backed_by_method_datatable_view(self): view = ColumnBackedByMethodDatatableView url = reverse("column-backed-by-method") view.request = FakeRequest(url) - response = self.client.get(url) - obj = self.get_json_response(url) + self.client.get(url) + self.get_json_response(url) def test_compound_columns_datatable_view(self): view = CompoundColumnsDatatableView url = reverse("compound-columns") view.request = FakeRequest(url) - response = self.client.get(url) - obj = self.get_json_response(url) + self.client.get(url) + self.get_json_response(url) def test_many_to_many_fields_datatable_view(self): view = ManyToManyFieldsDatatableView url = reverse("many-to-many-fields") view.request = FakeRequest(url) - response = self.client.get(url) - obj = self.get_json_response(url) + self.client.get(url) + self.get_json_response(url) def test_default_callback_names_datatable_view(self): view = DefaultCallbackNamesDatatableView url = reverse("default-callback-names") view.request = FakeRequest(url) - response = self.client.get(url) - obj = self.get_json_response(url) + self.client.get(url) + self.get_json_response(url) def test_helpers_reference_datatable_view(self): view = HelpersReferenceDatatableView url = reverse("helpers-reference") view.request = FakeRequest(url) - response = self.client.get(url) - obj = self.get_json_response(url) + self.client.get(url) + self.get_json_response(url) def test_satellite_datatable_view(self): view = SatelliteDatatableView url = reverse("satellite") view.request = FakeRequest(url) - response = self.client.get(url) - obj = self.get_json_response(url) + self.client.get(url) + self.get_json_response(url) diff --git a/demo_app/demo_app/settings_test.py b/demo_app/demo_app/settings_test.py index 74e5e25..e02102d 100644 --- a/demo_app/demo_app/settings_test.py +++ b/demo_app/demo_app/settings_test.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- - +import os import warnings from .settings import * # noqa: F403,F401 @@ -7,12 +7,12 @@ # Handle system warning as log messages warnings.simplefilter("once") -for handler in LOGGING.get("handlers", []): - LOGGING["handlers"][handler]["level"] = "CRITICAL" -for logger in LOGGING.get("loggers", []): - LOGGING["loggers"][logger]["level"] = "CRITICAL" +for handler in LOGGING.get("handlers", []): # noqa: F405 + LOGGING["handlers"][handler]["level"] = "CRITICAL" # noqa: F405 +for logger in LOGGING.get("loggers", []): # noqa: F405 + LOGGING["loggers"][logger]["level"] = "CRITICAL" # noqa: F405 -mysql_db = DATABASES["default"] +mysql_db = DATABASES["default"] # noqa: F405 DEFAULT_DB = { "ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:", diff --git a/demo_app/example_app/views.py b/demo_app/example_app/views.py index 26453a7..87a8356 100644 --- a/demo_app/example_app/views.py +++ b/demo_app/example_app/views.py @@ -39,7 +39,7 @@ def get_context_data(self, **kwargs): db_works = True try: list(Entry.objects.all()[:1]) - except: + except Exception: db_works = False context["db_works"] = db_works