Skip to content

Commit 6a0bea5

Browse files
author
codedawi
committed
🤖 black and isort files
1 parent 9d89eb3 commit 6a0bea5

File tree

6 files changed

+30
-13
lines changed

6 files changed

+30
-13
lines changed

app/utils/populations.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
import json
33
import logging
44

5-
import requests
6-
75
import app.io
6+
import requests
87

98
LOGGER = logging.getLogger(__name__)
109
GEONAMES_URL = "http://api.geonames.org/countryInfoJSON"

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
import os
88

99
import pytest
10-
from async_asgi_testclient import TestClient as AsyncTestClient
11-
from fastapi.testclient import TestClient
1210

1311
from app.main import APP
1412
from app.utils import httputils
13+
from async_asgi_testclient import TestClient as AsyncTestClient
14+
from fastapi.testclient import TestClient
1515

1616
try:
1717
from unittest.mock import AsyncMock

tests/test_jhu.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,24 @@ async def test_get_locations(mock_client_session):
3535
@pytest.mark.parametrize(
3636
"key, locations, index, expected",
3737
[
38-
(("Thailand", "TH"), [{"country": "Thailand", "province": "TH", "history": {"test": "yes"}}], 0, {"test": "yes"}), # Success
39-
(("Deutschland", "DE"), [{"country": "Deutschland", "province": "DE", "history": {"test": "no"}}], 1, {}), # IndexError
40-
(("US", "NJ"), [{"country": "Deutschland", "province": "DE", "history": {"test": "no"}}], 0, {}), # Invaid Key Merge
38+
(
39+
("Thailand", "TH"),
40+
[{"country": "Thailand", "province": "TH", "history": {"test": "yes"}}],
41+
0,
42+
{"test": "yes"},
43+
), # Success
44+
(
45+
("Deutschland", "DE"),
46+
[{"country": "Deutschland", "province": "DE", "history": {"test": "no"}}],
47+
1,
48+
{},
49+
), # IndexError
50+
(
51+
("US", "NJ"),
52+
[{"country": "Deutschland", "province": "DE", "history": {"test": "no"}}],
53+
0,
54+
{},
55+
), # Invaid Key Merge
4156
],
4257
)
4358
def test_parse_history(key, locations, index, expected):

tests/test_location_service.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
from app.services.location import LocationService
44

5+
56
class GoodLocationService(LocationService):
67
"""Valid LocationService Class."""
8+
79
async def get_all(self):
810
"""
911
Gets and returns all of the locations.
@@ -16,8 +18,10 @@ async def get(self, id): # pylint: disable=redefined-builtin,invalid-name
1618
"""
1719
return id
1820

21+
1922
class BadLocationService(LocationService):
2023
"""Invalid LocationService Class."""
24+
2125
pass
2226

2327

@@ -32,5 +36,4 @@ async def test_location_service_invalid():
3236
"""Test for location service interface valid class."""
3337
good_loc_service = GoodLocationService()
3438
assert [1] == await good_loc_service.get_all()
35-
assert 1 == await good_loc_service.get(1)
36-
39+
assert 1 == await good_loc_service.get(1)

tests/test_populations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""tests.test_populations.py"""
22
import pytest
3-
import requests.exceptions
4-
import responses
53

64
import app.io
75
import app.utils.populations
6+
import requests.exceptions
7+
import responses
88

99
NOT_FOUND_HTML = """<!DOCTYPE html>
1010
<html lang="en">

tests/test_routes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from unittest import mock
55

66
import pytest
7-
from async_asgi_testclient import TestClient
87

98
from app.main import APP
9+
from async_asgi_testclient import TestClient
1010

1111
from .conftest import mocked_strptime_isoformat
1212
from .test_jhu import DATETIME_STRING
@@ -181,4 +181,4 @@ async def test_latest(async_api_client, query_params, mock_client_session):
181181

182182
assert response.status_code == 200
183183
assert response_json["latest"]["confirmed"]
184-
assert response_json["latest"]["deaths"]
184+
assert response_json["latest"]["deaths"]

0 commit comments

Comments
 (0)