Skip to content

Commit

Permalink
Rename update method to async_update
Browse files Browse the repository at this point in the history
  • Loading branch information
bieniu committed May 5, 2021
1 parent 898a5e3 commit 866cf4f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def main():
try:
async with ClientSession() as websession:
gios = Gios(GIOS_STATION_ID, websession)
data = await gios.update()
data = await gios.async_update()
except (ApiError, NoStationError, InvalidSensorsData, ClientError) as error:
print(f"{error}")
return
Expand Down
2 changes: 1 addition & 1 deletion example.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async def main():
try:
async with ClientSession() as websession:
gios = Gios(GIOS_STATION_ID, websession)
data = await gios.update()
data = await gios.async_update()
except (ApiError, NoStationError, InvalidSensorsData, ClientError) as error:
print(f"{error}")
return
Expand Down
2 changes: 1 addition & 1 deletion gios/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, station_id: str, session: ClientSession) -> None:

self.session = session

async def update(self) -> Dict[str, Any]: # pylint:disable=too-many-branches
async def async_update(self) -> Dict[str, Any]: # pylint:disable=too-many-branches
"""Update GIOS data."""
data: Dict[str, Dict[str, Any]] = {}
invalid_sensors: List[str] = []
Expand Down
18 changes: 9 additions & 9 deletions tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def test_valid_data_first_value(): # pylint:disable=too-many-statements
)

gios = Gios(VALID_STATION_ID, session)
data = await gios.update()
data = await gios.async_update()

await session.close()

Expand Down Expand Up @@ -122,7 +122,7 @@ async def test_api_error():
)
gios = Gios(VALID_STATION_ID, session)
try:
await gios.update()
await gios.async_update()
except ApiError as error:
assert str(error.status) == "404"

Expand Down Expand Up @@ -206,7 +206,7 @@ async def test_valid_data_second_value(): # pylint:disable=too-many-statements
)

gios = Gios(VALID_STATION_ID, session)
data = await gios.update()
data = await gios.async_update()

await session.close()

Expand Down Expand Up @@ -300,7 +300,7 @@ async def test_no_indexes_data():

gios = Gios(VALID_STATION_ID, session)
try:
await gios.update()
await gios.async_update()
except InvalidSensorsData as error:
assert str(error.status) == "Invalid index data from GIOS API"

Expand Down Expand Up @@ -392,7 +392,7 @@ async def test_no_sensor_data_1(): # pylint:disable=too-many-statements

gios = Gios(VALID_STATION_ID, session)
try:
await gios.update()
await gios.async_update()
except InvalidSensorsData as error:
assert str(error.status) == "Invalid sensor data from GIOS API"

Expand Down Expand Up @@ -449,7 +449,7 @@ async def test_invalid_sensor_data_2():

gios = Gios(VALID_STATION_ID, session)
try:
await gios.update()
await gios.async_update()
except InvalidSensorsData as error:
assert str(error.status) == "Invalid sensor data from GIOS API"

Expand All @@ -475,7 +475,7 @@ async def test_no_station_data():
)
gios = Gios(VALID_STATION_ID, session)
try:
await gios.update()
await gios.async_update()
except InvalidSensorsData as error:
assert str(error.status) == "Invalid measuring station data from GIOS API"

Expand All @@ -494,7 +494,7 @@ async def test_no_stations_data():
)
gios = Gios(VALID_STATION_ID, session)
try:
await gios.update()
await gios.async_update()
except ApiError as error:
assert str(error.status) == "Invalid measuring stations list from GIOS API"

Expand All @@ -517,7 +517,7 @@ async def test_invalid_station_id():

gios = Gios(INVALID_STATION_ID, session)
try:
await gios.update()
await gios.async_update()
except NoStationError as error:
assert str(error.status) == "0 is not a valid measuring station ID"

Expand Down

0 comments on commit 866cf4f

Please sign in to comment.