File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77# NOTE: Testing keys https://opencagedata.com/api#testingkeys
88
9+ @pytest .mark .asyncio
910async def test_success ():
1011 async with OpenCageGeocode ('6d0e711d72d74daeb2b0bfd2a5cdfdba' ) as geocoder :
1112 results = await geocoder .geocode_async ("EC1M 5RF" )
@@ -15,13 +16,15 @@ async def test_success():
1516 for result in results
1617 )
1718
19+ @pytest .mark .asyncio
1820async def test_failure ():
1921 async with OpenCageGeocode ('6c79ee8e1ca44ad58ad1fc493ba9542f' ) as geocoder :
2022 with pytest .raises (ForbiddenError ) as excinfo :
2123 await geocoder .geocode_async ("Atlantis" )
2224
2325 assert str (excinfo .value ) == 'Your API key has been blocked or suspended.'
2426
27+ @pytest .mark .asyncio
2528async def test_without_async_session ():
2629 geocoder = OpenCageGeocode ('4372eff77b8343cebfc843eb4da4ddc4' )
2730
@@ -30,6 +33,7 @@ async def test_without_async_session():
3033
3134 assert str (excinfo .value ) == 'Async methods must be used inside an async context.'
3235
36+ @pytest .mark .asyncio
3337async def test_using_non_async_method ():
3438 async with OpenCageGeocode ('6d0e711d72d74daeb2b0bfd2a5cdfdba' ) as geocoder :
3539 with pytest .raises (AioHttpError ) as excinfo :
Original file line number Diff line number Diff line change 66 httpretty
77 pytest
88 pytest-aiohttp
9+ pytest-asyncio
910commands = pytest test
1011
1112[testenv:lint]
You can’t perform that action at this time.
0 commit comments