Skip to content

Commit 9b25488

Browse files
committed
[#13] resolve flake8 errors/warnings
1 parent 4772177 commit 9b25488

11 files changed

+36
-38
lines changed

src/objects/api/serializers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def create(self, validated_data):
126126
@transaction.atomic
127127
def update(self, instance, validated_data):
128128
# object_data is not used since all object attributes are immutable
129-
object_data = validated_data.pop("object", None)
129+
validated_data.pop("object", None)
130130
validated_data["object"] = instance.object
131131
# version should be set
132132
if "version" not in validated_data:

src/objects/config/objecttypes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ def test_configuration(self) -> None:
5656
try:
5757
response.json()
5858
except requests.exceptions.JSONDecodeError:
59-
raise SelfTestFailed(f"Object type version didn't have any data")
59+
raise SelfTestFailed("Object type version didn't have any data")

src/objects/core/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def clean(self):
5151
try:
5252
object_type_data = response.json()
5353
except requests.exceptions.JSONDecodeError:
54-
ValidationError(f"Object type version didn't have any data")
54+
ValidationError("Object type version didn't have any data")
5555

5656
if not self._name:
5757
self._name = object_type_data["name"]

src/objects/tests/commands/test_setup_configuration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def test_setup_configuration(self, m):
5757
f"{ObjecttypesStep()} is successfully configured",
5858
f"Configuring {DemoUserStep()}...",
5959
f"{DemoUserStep()} is successfully configured",
60-
f"Instance configuration completed.",
60+
"Instance configuration completed.",
6161
]
6262

6363
self.assertEqual(command_output, expected_output)

src/objects/tests/config/test_objecttypes_configuration.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from unittest.mock import patch
2-
31
from django.test import TestCase, override_settings
42

53
import requests

src/objects/tests/v1/test_filters.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def test_filter_exclude_old_records(self):
317317
start_at=date.today() - timedelta(days=10),
318318
end_at=date.today() - timedelta(days=1),
319319
)
320-
record_new = ObjectRecordFactory.create(
320+
ObjectRecordFactory.create(
321321
data={"diameter": 50}, object=record_old.object, start_at=record_old.end_at
322322
)
323323

@@ -371,7 +371,7 @@ def test_filter_date_detail(self):
371371
record1 = ObjectRecordFactory.create(
372372
object=object, start_at="2020-01-01", end_at="2020-12-31"
373373
)
374-
record2 = ObjectRecordFactory.create(object=object, start_at="2021-01-01")
374+
ObjectRecordFactory.create(object=object, start_at="2021-01-01")
375375

376376
url = reverse_lazy("object-detail", args=[object.uuid])
377377

@@ -385,7 +385,7 @@ def test_filter_date_detail(self):
385385

386386
def test_filter_date_detail_no_actual_record(self):
387387
object = ObjectFactory.create(object_type=self.object_type)
388-
record = ObjectRecordFactory.create(object=object, start_at="2021-01-01")
388+
ObjectRecordFactory.create(object=object, start_at="2021-01-01")
389389

390390
url = reverse_lazy("object-detail", args=[object.uuid])
391391

@@ -399,9 +399,9 @@ def test_filter_date_list(self):
399399
record11 = ObjectRecordFactory.create(
400400
object=object1, start_at="2020-01-01", end_at="2020-12-31"
401401
)
402-
record12 = ObjectRecordFactory.create(object=object1, start_at="2021-01-01")
402+
ObjectRecordFactory.create(object=object1, start_at="2021-01-01")
403403
# object 2 - don't show
404-
record21 = ObjectRecordFactory.create(
404+
ObjectRecordFactory.create(
405405
object__object_type=self.object_type, start_at="2021-01-01"
406406
)
407407

@@ -424,7 +424,7 @@ def test_filter_registration_date_detail(self):
424424
object=object,
425425
registration_at="2020-01-01",
426426
)
427-
record2 = ObjectRecordFactory.create(
427+
ObjectRecordFactory.create(
428428
object=object, registration_at="2021-01-01"
429429
)
430430

@@ -440,7 +440,7 @@ def test_filter_registration_date_detail(self):
440440

441441
def test_filter_registration_date_detail_no_record(self):
442442
object = ObjectFactory.create(object_type=self.object_type)
443-
record = ObjectRecordFactory.create(object=object, registration_at="2021-01-01")
443+
ObjectRecordFactory.create(object=object, registration_at="2021-01-01")
444444

445445
url = reverse_lazy("object-detail", args=[object.uuid])
446446

@@ -454,11 +454,11 @@ def test_filter_registration_date_list(self):
454454
record11 = ObjectRecordFactory.create(
455455
object=object1, registration_at="2020-01-01"
456456
)
457-
record12 = ObjectRecordFactory.create(
457+
ObjectRecordFactory.create(
458458
object=object1, registration_at="2021-01-01"
459459
)
460460
# object 2 - don't show
461-
record21 = ObjectRecordFactory.create(
461+
ObjectRecordFactory.create(
462462
object__object_type=self.object_type, registration_at="2021-01-01"
463463
)
464464

src/objects/tests/v1/test_object_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_list_actual_objects(self, m):
4444
object__object_type=self.object_type,
4545
start_at=date.today(),
4646
)
47-
object_record2 = ObjectRecordFactory.create(
47+
ObjectRecordFactory.create(
4848
object__object_type=self.object_type,
4949
start_at=date.today() - timedelta(days=10),
5050
end_at=date.today() - timedelta(days=1),

src/objects/tests/v1/test_stuf.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def test_2a_2_records_found(self):
103103
Test 2a: If records 1 and 40 exists, material history and formal history on
104104
01-01-2020 should say: Record 40
105105
"""
106-
record_1 = ObjectRecordFactory.create(
106+
ObjectRecordFactory.create(
107107
object=self.object,
108108
data={
109109
"geslachtsnaam": "Poepenstaart",
@@ -177,7 +177,7 @@ def test_3a_3_records_found(self):
177177
Test 3a: If records 1, 40 and 50 exists, material history and formal history
178178
on 01-01-2020 should say: Record 50
179179
"""
180-
record_1 = ObjectRecordFactory.create(
180+
ObjectRecordFactory.create(
181181
object=self.object,
182182
data={
183183
"geslachtsnaam": "Poepenstaart",
@@ -189,7 +189,7 @@ def test_3a_3_records_found(self):
189189
end_at=date(2001, 9, 3),
190190
registration_at=date(1977, 8, 7),
191191
)
192-
record_40 = ObjectRecordFactory.create(
192+
ObjectRecordFactory.create(
193193
object=self.object,
194194
data={
195195
"geslachtsnaam": "Bergh",
@@ -274,7 +274,7 @@ def test_3b_3_records_not_found(self):
274274

275275

276276
class Stuf22Tests(TokenAuthMixin, APITestCase):
277-
"""
277+
""" # noqa
278278
Test cases based on the Table 2.2 in the StUF 03.01
279279
|PersoonsId|volgnummer|geslachtsnaam|voorvoegsel|voorletters|geboortedatum|burgerlijkestaat|beginGeldigheid|tijdstipRegistratie|
280280
|----------|----------|-------------|-----------|-----------|-------------|----------------|---------------|-------------------|
@@ -403,7 +403,7 @@ def test_4d_not_found(self):
403403

404404

405405
class Stuf23Tests(TokenAuthMixin, APITestCase):
406-
"""
406+
""" # noqa
407407
Test cases based on the Table 2.2 in the StUF 03.01
408408
|PersoonsId|volgnummer|geslachtsnaam|voorvoegsel|voorletters|geboortedatum|burgerlijkestaat|beginGeldigheid|tijdstipRegistratie|volgnrNaCorrectie|
409409
|----------|----------|-------------|-----------|-----------|-------------|----------------|---------------|-------------------|-----------------|

src/objects/tests/v2/test_filters.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def test_filter_exclude_old_records(self):
366366
start_at=date.today() - timedelta(days=10),
367367
end_at=date.today() - timedelta(days=1),
368368
)
369-
record_new = ObjectRecordFactory.create(
369+
ObjectRecordFactory.create(
370370
data={"diameter": 50}, object=record_old.object, start_at=record_old.end_at
371371
)
372372

@@ -378,7 +378,7 @@ def test_filter_exclude_old_records(self):
378378
self.assertEqual(len(data), 0)
379379

380380
def test_filter_date_field_gte(self):
381-
record = ObjectRecordFactory.create(
381+
ObjectRecordFactory.create(
382382
data={"dateField": "2000-10-10"}, object__object_type=self.object_type
383383
)
384384

@@ -445,7 +445,7 @@ def test_filter_date_detail(self):
445445
record1 = ObjectRecordFactory.create(
446446
object=object, start_at="2020-01-01", end_at="2020-12-31"
447447
)
448-
record2 = ObjectRecordFactory.create(object=object, start_at="2021-01-01")
448+
ObjectRecordFactory.create(object=object, start_at="2021-01-01")
449449

450450
url = reverse_lazy("object-detail", args=[object.uuid])
451451

@@ -459,7 +459,7 @@ def test_filter_date_detail(self):
459459

460460
def test_filter_date_detail_no_actual_record(self):
461461
object = ObjectFactory.create(object_type=self.object_type)
462-
record = ObjectRecordFactory.create(object=object, start_at="2021-01-01")
462+
ObjectRecordFactory.create(object=object, start_at="2021-01-01")
463463

464464
url = reverse_lazy("object-detail", args=[object.uuid])
465465

@@ -473,9 +473,9 @@ def test_filter_date_list(self):
473473
record11 = ObjectRecordFactory.create(
474474
object=object1, start_at="2020-01-01", end_at="2020-12-31"
475475
)
476-
record12 = ObjectRecordFactory.create(object=object1, start_at="2021-01-01")
476+
ObjectRecordFactory.create(object=object1, start_at="2021-01-01")
477477
# object 2 - don't show
478-
record21 = ObjectRecordFactory.create(
478+
ObjectRecordFactory.create(
479479
object__object_type=self.object_type, start_at="2021-01-01"
480480
)
481481

@@ -498,7 +498,7 @@ def test_filter_registration_date_detail(self):
498498
object=object,
499499
registration_at="2020-01-01",
500500
)
501-
record2 = ObjectRecordFactory.create(
501+
ObjectRecordFactory.create(
502502
object=object, registration_at="2021-01-01"
503503
)
504504

@@ -514,7 +514,7 @@ def test_filter_registration_date_detail(self):
514514

515515
def test_filter_registration_date_detail_no_record(self):
516516
object = ObjectFactory.create(object_type=self.object_type)
517-
record = ObjectRecordFactory.create(object=object, registration_at="2021-01-01")
517+
ObjectRecordFactory.create(object=object, registration_at="2021-01-01")
518518

519519
url = reverse_lazy("object-detail", args=[object.uuid])
520520

@@ -528,11 +528,11 @@ def test_filter_registration_date_list(self):
528528
record11 = ObjectRecordFactory.create(
529529
object=object1, registration_at="2020-01-01"
530530
)
531-
record12 = ObjectRecordFactory.create(
531+
ObjectRecordFactory.create(
532532
object=object1, registration_at="2021-01-01"
533533
)
534534
# object 2 - don't show
535-
record21 = ObjectRecordFactory.create(
535+
ObjectRecordFactory.create(
536536
object__object_type=self.object_type, registration_at="2021-01-01"
537537
)
538538

src/objects/tests/v2/test_object_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def test_list_actual_objects(self, m):
4848
object__object_type=self.object_type,
4949
start_at=date.today(),
5050
)
51-
object_record2 = ObjectRecordFactory.create(
51+
ObjectRecordFactory.create(
5252
object__object_type=self.object_type,
5353
start_at=date.today() - timedelta(days=10),
5454
end_at=date.today() - timedelta(days=1),

src/objects/tests/v2/test_stuf.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525

2626
class Stuf21Tests(TokenAuthMixin, APITestCase):
27-
"""
27+
""" # noqa
2828
Test cases based on the Table 2.1 in the StUF 03.01
2929
|PersoonsId|volgnummer|geslachtsnaam|voorvoegsel|voorletters|geboortedatum|burgerlijkestaat|beginGeldigheid|
3030
|----------|----------|-------------|-----------|-----------|-------------|----------------|---------------|
@@ -103,7 +103,7 @@ def test_2a_2_records_found(self):
103103
Test 2a: If records 1 and 40 exists, material history and formal history on
104104
01-01-2020 should say: Record 40
105105
"""
106-
record_1 = ObjectRecordFactory.create(
106+
ObjectRecordFactory.create(
107107
object=self.object,
108108
data={
109109
"geslachtsnaam": "Poepenstaart",
@@ -177,7 +177,7 @@ def test_3a_3_records_found(self):
177177
Test 3a: If records 1, 40 and 50 exists, material history and formal history
178178
on 01-01-2020 should say: Record 50
179179
"""
180-
record_1 = ObjectRecordFactory.create(
180+
ObjectRecordFactory.create(
181181
object=self.object,
182182
data={
183183
"geslachtsnaam": "Poepenstaart",
@@ -189,7 +189,7 @@ def test_3a_3_records_found(self):
189189
end_at=date(2001, 9, 3),
190190
registration_at=date(1977, 8, 7),
191191
)
192-
record_40 = ObjectRecordFactory.create(
192+
ObjectRecordFactory.create(
193193
object=self.object,
194194
data={
195195
"geslachtsnaam": "Bergh",
@@ -274,7 +274,7 @@ def test_3b_3_records_not_found(self):
274274

275275

276276
class Stuf22Tests(TokenAuthMixin, APITestCase):
277-
"""
277+
""" # noqa
278278
Test cases based on the Table 2.2 in the StUF 03.01
279279
|PersoonsId|volgnummer|geslachtsnaam|voorvoegsel|voorletters|geboortedatum|burgerlijkestaat|beginGeldigheid|tijdstipRegistratie|
280280
|----------|----------|-------------|-----------|-----------|-------------|----------------|---------------|-------------------|
@@ -403,7 +403,7 @@ def test_4d_not_found(self):
403403

404404

405405
class Stuf23Tests(TokenAuthMixin, APITestCase):
406-
"""
406+
""" # noqa
407407
Test cases based on the Table 2.2 in the StUF 03.01
408408
|PersoonsId|volgnummer|geslachtsnaam|voorvoegsel|voorletters|geboortedatum|burgerlijkestaat|beginGeldigheid|tijdstipRegistratie|volgnrNaCorrectie|
409409
|----------|----------|-------------|-----------|-----------|-------------|----------------|---------------|-------------------|-----------------|

0 commit comments

Comments
 (0)