repo_id
stringclasses
409 values
prefix
large_stringlengths
34
36.3k
target
large_stringlengths
1
498
assertion_type
stringclasses
31 values
difficulty
stringclasses
8 values
test_file
stringlengths
10
121
test_function
stringlengths
1
104
test_class
stringlengths
0
51
lineno
int32
2
11.3k
commit_idx
int32
geopy/geopy
import datetime import pickle import unittest import pytest from geopy.timezone import Timezone, from_fixed_gmt_offset, from_timezone_name class TimezoneTestCase(unittest.TestCase): timezone_gmt_offset_hours = 3 timezone_name = "Europe/Moscow" # a DST-less timezone def test_create_from_timezone_name(s...
datetime.tzinfo)
self.assertIsInstance
complex_expr
test/test_timezone.py
test_create_from_timezone_name
TimezoneTestCase
29
null
geopy/geopy
from geopy.geocoders import Photon from geopy.point import Point from test.geocoders.util import BaseTestGeocoder class TestPhoton(BaseTestGeocoder): known_country_de = "Frankreich" known_country_fr = "France" def make_geocoder(cls, **kwargs): return Photon(**kwargs) async def test_reverse_la...
self.known_country_fr
assert
complex_expr
test/geocoders/photon.py
test_reverse_language_parameter
TestPhoton
84
null
geopy/geopy
import inspect import pytest import geopy.exc error_classes = sorted( [ v for v in (getattr(geopy.exc, name) for name in dir(geopy.exc)) if inspect.isclass(v) and issubclass(v, geopy.exc.GeopyError) ], key=lambda cls: cls.__name__, ) @pytest.mark.parametrize("error_cls", error_cl...
error_cls)
pytest.raises
variable
test/test_exc.py
test_init
19
null
geopy/geopy
import base64 from datetime import datetime from urllib.parse import parse_qs, urlparse import pytest from geopy import exc from geopy.geocoders import GoogleV3 from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestGoogleV3(BaseTestGeocoder): new_york_point = Point(40.7537...
exc.GeocoderQueryError)
pytest.raises
complex_expr
test/geocoders/googlev3.py
test_check_status
TestGoogleV3
56
null
geopy/geopy
from geopy.geocoders import MapQuest from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestMapQuest(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return MapQuest(api_key=env['MAPQUEST_KEY'], timeout=3, **kwargs) async def test_geocode_raw(self): ...
"US"
assert
string_literal
test/geocoders/mapquest.py
test_geocode_raw
TestMapQuest
47
null
geopy/geopy
from geopy.geocoders import Geolake from test.geocoders.util import BaseTestGeocoder, env class TestUnitGeolake: def test_user_agent_custom(self): geocoder = Geolake( api_key='DUMMYKEY1234', user_agent='my_user_agent/1.0' ) assert geocoder.headers['User-Agent'] ==
'my_user_agent/1.0'
assert
string_literal
test/geocoders/geolake.py
test_user_agent_custom
TestUnitGeolake
12
null
geopy/geopy
import uuid import pytest from geopy import Point from geopy.exc import GeocoderAuthenticationFailure, GeocoderQueryError from geopy.geocoders import GeoNames from test.geocoders.util import BaseTestGeocoder, env class TestGeoNamesInvalidAccount(BaseTestGeocoder): def make_geocoder(cls, **kwargs): retur...
GeocoderAuthenticationFailure)
pytest.raises
variable
test/geocoders/geonames.py
test_reverse_timezone
TestGeoNamesInvalidAccount
207
null
geopy/geopy
import importlib import inspect import pkgutil import docutils.core import docutils.utils import pytest import geopy.geocoders from geopy.geocoders.base import DEFAULT_SENTINEL, Geocoder skip_modules = [ "geopy.geocoders.base", # doesn't contain actual geocoders "geopy.geocoders.googlev3", # deprecated ...
method.__doc__)
assert_*
complex_expr
test/geocoders/__init__.py
test_init_method_signature
180
null
geopy/geopy
import pytest from geopy import exc from geopy.geocoders import Woosmap from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestWoosmap(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return Woosmap(api_key=env['WOOSMAP_KEY'], **kwargs) async def test_forma...
ValueError)
pytest.raises
variable
test/geocoders/woosmap.py
test_format_components_param
TestWoosmap
53
null
geopy/geopy
import unittest from contextlib import ExitStack from unittest.mock import patch, sentinel import pytest import geopy.geocoders import geopy.geocoders.base from geopy.adapters import BaseAsyncAdapter, BaseSyncAdapter from geopy.exc import GeocoderNotFound, GeocoderQueryError from geopy.geocoders import GoogleV3, get_...
RuntimeError)
pytest.raises
variable
test/geocoders/base.py
test_synchronize_decorator_sync_exception
278
null
geopy/geopy
import datetime import pickle import unittest import pytest from geopy.timezone import Timezone, from_fixed_gmt_offset, from_timezone_name class TimezoneTestCase(unittest.TestCase): timezone_gmt_offset_hours = 3 timezone_name = "Europe/Moscow" # a DST-less timezone def test_picklable(self): ra...
tz_unp)
self.assertEqual
variable
test/test_timezone.py
test_picklable
TimezoneTestCase
78
null
geopy/geopy
import unittest from contextlib import ExitStack from unittest.mock import patch, sentinel import pytest import geopy.geocoders import geopy.geocoders.base from geopy.adapters import BaseAsyncAdapter, BaseSyncAdapter from geopy.exc import GeocoderNotFound, GeocoderQueryError from geopy.geocoders import GoogleV3, get_...
list(range(5))
assert
func_call
test/geocoders/base.py
test_synchronize_decorator_sync_reentrance
315
null
geopy/geopy
import pytest from geopy.geocoders import MapBox from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestMapBox(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return MapBox(api_key=env['MAPBOX_KEY'], timeout=3, **kwargs) async def test_reverse(self): ...
location.address
assert
complex_expr
test/geocoders/mapbox.py
test_reverse
TestMapBox
25
null
geopy/geopy
import base64 from datetime import datetime from urllib.parse import parse_qs, urlparse import pytest from geopy import exc from geopy.geocoders import GoogleV3 from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestGoogleV3(BaseTestGeocoder): new_york_point = Point(40.7537...
exc.ConfigurationError)
pytest.raises
complex_expr
test/geocoders/googlev3.py
test_configuration_error
TestGoogleV3
34
null
geopy/geopy
import warnings import pytest from geopy import exc from geopy.geocoders import Here, HereV7 from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class BaseTestHere(BaseTestGeocoder): async def test_geocode_with_paging(self): address_string = "Hauptstr., Berlin, Germany" ...
3
assert
numeric_literal
test/geocoders/here.py
test_geocode_with_paging
BaseTestHere
123
null
geopy/geopy
import math import unittest import warnings from geopy.distance import ( EARTH_RADIUS, Distance, GeodesicDistance, GreatCircleDistance, distance, lonlat, ) from geopy.point import Point EARTH_CIRCUMFERENCE = 2 * math.pi * EARTH_RADIUS NORTH_POLE = Point(90, 0) SOUTH_POLE = Point(-90, 0) FIJI =...
0.0)
self.assertAlmostEqual
numeric_literal
test/test_distance.py
test_should_compute_destination_across_antimeridian
CommonDistanceComputationCases
84
null
geopy/geopy
import unittest from contextlib import ExitStack from unittest.mock import patch, sentinel import pytest import geopy.geocoders import geopy.geocoders.base from geopy.adapters import BaseAsyncAdapter, BaseSyncAdapter from geopy.exc import GeocoderNotFound, GeocoderQueryError from geopy.geocoders import GoogleV3, get_...
GoogleV3
assert
variable
test/geocoders/base.py
test_get_geocoder_for_service
GetGeocoderTestCase
35
null
geopy/geopy
import pytest from geopy.exc import GeocoderAuthenticationFailure from geopy.geocoders import Baidu, BaiduV3 from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestUnitBaidu(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return Baidu( api_key='DUMM...
'my_user_agent/1.0'
assert
string_literal
test/geocoders/baidu.py
test_user_agent_custom
TestUnitBaidu
20
null
geopy/geopy
import datetime import pickle import unittest import pytest from geopy.timezone import Timezone, from_fixed_gmt_offset, from_timezone_name class TimezoneTestCase(unittest.TestCase): timezone_gmt_offset_hours = 3 timezone_name = "Europe/Moscow" # a DST-less timezone def test_create_from_fixed_gmt_offse...
olson_tz.utcoffset(dt))
self.assertEqual
func_call
test/test_timezone.py
test_create_from_fixed_gmt_offset
TimezoneTestCase
41
null
geopy/geopy
import pytest from geopy.geocoders import MapBox from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestMapBox(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return MapBox(api_key=env['MAPBOX_KEY'], timeout=3, **kwargs) async def test_geocode_raw(self): ...
result.raw['center']
assert
complex_expr
test/geocoders/mapbox.py
test_geocode_raw
TestMapBox
77
null
geopy/geopy
import unittest from contextlib import ExitStack from unittest.mock import patch, sentinel import pytest import geopy.geocoders import geopy.geocoders.base from geopy.adapters import BaseAsyncAdapter, BaseSyncAdapter from geopy.exc import GeocoderNotFound, GeocoderQueryError from geopy.geocoders import GoogleV3, get_...
ValueError)
pytest.raises
variable
test/geocoders/base.py
test_address
GeocoderPointCoercionTestCase
183
null
geopy/geopy
import contextlib import os import ssl from unittest.mock import patch from urllib.parse import urljoin from urllib.request import getproxies, urlopen import pytest import geopy.geocoders from geopy.adapters import ( AdapterHTTPError, AioHTTPAdapter, BaseAsyncAdapter, RequestsAdapter, URLLibAdapte...
'Not found'
assert
string_literal
test/adapters/each_adapter.py
test_adapter_exception_for_non_200_response
341
null
geopy/geopy
import warnings from unittest.mock import patch import pytest import geopy.geocoders from geopy.exc import ConfigurationError from geopy.geocoders import Nominatim from geopy.point import Point from test.geocoders.util import BaseTestGeocoder class BaseTestNominatim(BaseTestGeocoder): delta = 0.04 async de...
ValueError)
pytest.raises
variable
test/geocoders/nominatim.py
test_limit
BaseTestNominatim
40
null
geopy/geopy
import pickle import unittest from geopy.location import Location from geopy.point import Point GRAND_CENTRAL_STR = "89 E 42nd St New York, NY 10017" GRAND_CENTRAL_COORDS_STR = "40.752662,-73.9773" GRAND_CENTRAL_COORDS_TUPLE = (40.752662, -73.9773, 0) GRAND_CENTRAL_POINT = Point(GRAND_CENTRAL_COORDS_STR) GRAND_CENT...
ref_address)
self.assertEqual
variable
test/test_location.py
_location_iter_test
LocationTestCase
34
null
geopy/geopy
import warnings from unittest.mock import patch import pytest import geopy.geocoders from geopy.exc import ConfigurationError from geopy.geocoders import Nominatim from geopy.point import Point from test.geocoders.util import BaseTestGeocoder class BaseTestNominatim(BaseTestGeocoder): delta = 0.04 async de...
result.raw
assert
complex_expr
test/geocoders/nominatim.py
test_geocode_namedetails
BaseTestNominatim
307
null
geopy/geopy
import warnings from geopy.geocoders import PickPoint from test.geocoders.nominatim import BaseTestNominatim from test.geocoders.util import env class TestPickPoint(BaseTestNominatim): def make_geocoder(cls, **kwargs): return PickPoint(api_key=env['PICKPOINT_KEY'], timeout=3, **k...
len(w)
assert
func_call
test/geocoders/pickpoint.py
test_no_nominatim_user_agent_warning
TestPickPoint
19
null
geopy/geopy
import datetime import pickle import unittest import pytest from geopy.timezone import Timezone, from_fixed_gmt_offset, from_timezone_name class TimezoneTestCase(unittest.TestCase): timezone_gmt_offset_hours = 3 timezone_name = "Europe/Moscow" # a DST-less timezone def test_eq(self): tz = pytz...
Timezone(tz, raw2))
self.assertEqual
func_call
test/test_timezone.py
test_eq
TimezoneTestCase
63
null
geopy/geopy
from unittest.mock import patch import geopy.geocoders from geopy.geocoders import LiveAddress from test.geocoders.util import BaseTestGeocoder, env class TestUnitLiveAddress: dummy_id = 'DUMMY12345' dummy_token = 'DUMMY67890' @patch.object(geopy.geocoders.options, 'default_scheme', 'http') def test_...
'https'
assert
string_literal
test/geocoders/smartystreets.py
test_default_scheme_is_ignored
TestUnitLiveAddress
23
null
geopy/geopy
import pytest from geopy import exc from geopy.geocoders import ArcGIS from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestArcGIS(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return ArcGIS(timeout=3, **kwargs) async def test_geocode_with_out_fields_s...
{'Country': 'GBR'}
assert
collection
test/geocoders/arcgis.py
test_geocode_with_out_fields_string
TestArcGIS
56
null
geopy/geopy
import pytest from geopy import exc from geopy.geocoders import Woosmap from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestWoosmap(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return Woosmap(api_key=env['WOOSMAP_KEY'], **kwargs) async def test_check...
exc.GeocoderServiceError)
pytest.raises
complex_expr
test/geocoders/woosmap.py
test_check_status
TestWoosmap
32
null
geopy/geopy
import warnings import pytest from geopy import exc from geopy.geocoders import Here, HereV7 from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class BaseTestHere(BaseTestGeocoder): async def test_geocode_with_language_de(self): address_string = "435 north michigan ave, ...
res.address
assert
complex_expr
test/geocoders/here.py
test_geocode_with_language_de
BaseTestHere
105
null
geopy/geopy
import importlib import inspect import pkgutil import docutils.core import docutils.utils import pytest import geopy.geocoders from geopy.geocoders.base import DEFAULT_SENTINEL, Geocoder skip_modules = [ "geopy.geocoders.base", # doesn't contain actual geocoders "geopy.geocoders.googlev3", # deprecated ...
True
assert
bool_literal
test/geocoders/__init__.py
test_geocode_method_signature
205
null
geopy/geopy
import pytest from geopy import exc from geopy.geocoders import ArcGIS from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestArcGIS(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return ArcGIS(timeout=3, **kwargs) async def test_geocode_with_out_fields_l...
{ 'City': 'London', 'Type': 'Tourist Attraction' }
assert
collection
test/geocoders/arcgis.py
test_geocode_with_out_fields_list
TestArcGIS
64
null
geopy/geopy
import pickle import unittest from geopy.location import Location from geopy.point import Point GRAND_CENTRAL_STR = "89 E 42nd St New York, NY 10017" GRAND_CENTRAL_COORDS_STR = "40.752662,-73.9773" GRAND_CENTRAL_COORDS_TUPLE = (40.752662, -73.9773, 0) GRAND_CENTRAL_POINT = Point(GRAND_CENTRAL_COORDS_STR) GRAND_CENT...
loc_unp)
self.assertEqual
variable
test/test_location.py
test_location_is_picklable
LocationTestCase
122
null
geopy/geopy
import math import pickle import sys import unittest import warnings from geopy.point import Point class PointTestCase(unittest.TestCase): lat = 40.74113 lon = -73.989656 alt = 3 coords = (lat, lon, alt) def test_point_float(self): point = Point(self.lat, self.lon, self.alt) self...
self.lon)
self.assertEqual
complex_expr
test/test_point.py
test_point_float
PointTestCase
18
null
geopy/geopy
import pytest from geopy import exc from geopy.geocoders import ArcGIS from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestArcGIS(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return ArcGIS(timeout=3, **kwargs) async def test_missing_password_error(se...
exc.ConfigurationError)
pytest.raises
complex_expr
test/geocoders/arcgis.py
test_missing_password_error
TestArcGIS
25
null
geopy/geopy
import unittest from contextlib import ExitStack from unittest.mock import patch, sentinel import pytest import geopy.geocoders import geopy.geocoders.base from geopy.adapters import BaseAsyncAdapter, BaseSyncAdapter from geopy.exc import GeocoderNotFound, GeocoderQueryError from geopy.geocoders import GoogleV3, get_...
expected
assert
variable
test/geocoders/base.py
test_output_format_is_respected
GeocoderPointCoercionTestCase
180
null
geopy/geopy
import pytest from geopy import exc from geopy.geocoders import Woosmap from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestWoosmap(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return Woosmap(api_key=env['WOOSMAP_KEY'], **kwargs) async def test_geoco...
result.address
assert
complex_expr
test/geocoders/woosmap.py
test_geocode_with_language
TestWoosmap
100
null
geopy/geopy
import datetime import pickle import unittest import pytest from geopy.timezone import Timezone, from_fixed_gmt_offset, from_timezone_name class TimezoneTestCase(unittest.TestCase): timezone_gmt_offset_hours = 3 timezone_name = "Europe/Moscow" # a DST-less timezone def test_create_from_timezone_name(s...
'bar')
self.assertEqual
string_literal
test/test_timezone.py
test_create_from_timezone_name
TimezoneTestCase
27
null
geopy/geopy
import pytest from geopy.exc import ( GeocoderInsufficientPrivileges, GeocoderQuotaExceeded, GeocoderRateLimited, ) from geopy.geocoders import OpenCage from test.geocoders.util import BaseTestGeocoder, env class TestUnitOpenCage: def test_user_agent_custom(self): geocoder = OpenCage( ...
'my_user_agent/1.0'
assert
string_literal
test/geocoders/opencage.py
test_user_agent_custom
TestUnitOpenCage
19
null
geopy/geopy
import contextlib import os import ssl from unittest.mock import patch from urllib.parse import urljoin from urllib.request import getproxies, urlopen import pytest import geopy.geocoders from geopy.adapters import ( AdapterHTTPError, AioHTTPAdapter, BaseAsyncAdapter, RequestsAdapter, URLLibAdapte...
str(excinfo.value)
assert
func_call
test/adapters/each_adapter.py
test_ssl_context_with_proxy_is_respected
258
null
geopy/geopy
import pickle import unittest from geopy.location import Location from geopy.point import Point GRAND_CENTRAL_STR = "89 E 42nd St New York, NY 10017" GRAND_CENTRAL_COORDS_STR = "40.752662,-73.9773" GRAND_CENTRAL_COORDS_TUPLE = (40.752662, -73.9773, 0) GRAND_CENTRAL_POINT = Point(GRAND_CENTRAL_COORDS_STR) GRAND_CENT...
loc.address)
self.assertEqual
complex_expr
test/test_location.py
test_location_string
LocationTestCase
87
null
geopy/geopy
import pickle import unittest from geopy.location import Location from geopy.point import Point GRAND_CENTRAL_STR = "89 E 42nd St New York, NY 10017" GRAND_CENTRAL_COORDS_STR = "40.752662,-73.9773" GRAND_CENTRAL_COORDS_TUPLE = (40.752662, -73.9773, 0) GRAND_CENTRAL_POINT = Point(GRAND_CENTRAL_COORDS_STR) GRAND_CENT...
GRAND_CENTRAL_COORDS_TUPLE[0])
self.assertEqual
complex_expr
test/test_location.py
_location_properties_test
LocationTestCase
40
null
geopy/geopy
import contextlib import json import os from abc import ABC, abstractmethod from unittest.mock import ANY, patch import pytest from geopy import exc from geopy.adapters import BaseAsyncAdapter from geopy.location import Location _env = {} class BaseTestGeocoder(ABC): geocoder = None delta = 0.5 async ...
longitude, abs=delta)
pytest.approx
complex_expr
test/geocoders/util.py
_verify_request
BaseTestGeocoder
207
null
geopy/geopy
from geopy.geocoders import OpenMapQuest from test.geocoders.nominatim import BaseTestNominatim from test.geocoders.util import env class TestUnitOpenMapQuest: def test_user_agent_custom(self): geocoder = OpenMapQuest( api_key='DUMMYKEY1234', user_agent='my_user_agent/1.0' ...
'my_user_agent/1.0'
assert
string_literal
test/geocoders/openmapquest.py
test_user_agent_custom
TestUnitOpenMapQuest
13
null
geopy/geopy
import datetime import pickle import unittest import pytest from geopy.timezone import Timezone, from_fixed_gmt_offset, from_timezone_name class TimezoneTestCase(unittest.TestCase): timezone_gmt_offset_hours = 3 timezone_name = "Europe/Moscow" # a DST-less timezone def test_ne(self): tz1 = pyt...
Timezone(tz2, raw))
self.assertNotEqual
func_call
test/test_timezone.py
test_ne
TimezoneTestCase
69
null
geopy/geopy
import contextlib import os import ssl from unittest.mock import patch from urllib.parse import urljoin from urllib.request import getproxies, urlopen import pytest import geopy.geocoders from geopy.adapters import ( AdapterHTTPError, AioHTTPAdapter, BaseAsyncAdapter, RequestsAdapter, URLLibAdapte...
GeocoderParseError)
pytest.raises
variable
test/adapters/each_adapter.py
test_get_json_failure_on_non_json
326
null
geopy/geopy
import pytest from geopy.exc import ( GeocoderInsufficientPrivileges, GeocoderQuotaExceeded, GeocoderRateLimited, ) from geopy.geocoders import OpenCage from test.geocoders.util import BaseTestGeocoder, env class TestOpenCage(BaseTestGeocoder): testing_tokens = { # https://opencagedata.com/ap...
location.raw
assert
complex_expr
test/geocoders/opencage.py
test_geocode_annotations
TestOpenCage
84
null
geopy/geopy
import contextlib import os import ssl from unittest.mock import patch from urllib.parse import urljoin from urllib.request import getproxies, urlopen import pytest import geopy.geocoders from geopy.adapters import ( AdapterHTTPError, AioHTTPAdapter, BaseAsyncAdapter, RequestsAdapter, URLLibAdapte...
'hello'
assert
string_literal
test/adapters/each_adapter.py
test_adapter_exception_for_non_200_response
340
null
geopy/geopy
import asyncio import atexit import contextlib import importlib import os import types from collections import defaultdict from functools import partial from statistics import mean, median from time import sleep from timeit import default_timer from unittest.mock import patch from urllib.parse import urlparse import p...
None
assert
none_literal
test/conftest.py
_wrapped_get
AdapterProxy
230
null
geopy/geopy
import pytest from geopy import exc from geopy.geocoders import ArcGIS from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestArcGIS(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return ArcGIS(timeout=3, **kwargs) async def test_reverse_point(self): ...
location.address
assert
complex_expr
test/geocoders/arcgis.py
test_reverse_point
TestArcGIS
73
null
geopy/geopy
from geopy.geocoders import Bing from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestBing(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return Bing( api_key=env['BING_KEY'], **kwargs ) async def test_optional_params(self...
"Ballard"
assert
string_literal
test/geocoders/bing.py
test_optional_params
TestBing
77
null
geopy/geopy
import pytest from geopy.exc import ( GeocoderInsufficientPrivileges, GeocoderQuotaExceeded, GeocoderRateLimited, ) from geopy.geocoders import OpenCage from test.geocoders.util import BaseTestGeocoder, env class TestOpenCage(BaseTestGeocoder): testing_tokens = { # https://opencagedata.com/ap...
GeocoderQuotaExceeded)
pytest.raises
variable
test/geocoders/opencage.py
test_payment_required_error
TestOpenCage
88
null
geopy/geopy
import warnings from unittest.mock import patch import pytest import geopy.geocoders from geopy.exc import ConfigurationError from geopy.geocoders import Nominatim from geopy.point import Point from test.geocoders.util import BaseTestGeocoder class TestNominatim(BaseTestNominatim): def make_geocoder(cls, **kwar...
1
assert
numeric_literal
test/geocoders/nominatim.py
test_import_deprecated_osm_module
TestNominatim
376
null
geopy/geopy
import warnings from unittest.mock import patch import pytest import geopy.geocoders from geopy.exc import ConfigurationError from geopy.geocoders import Nominatim from geopy.point import Point from test.geocoders.util import BaseTestGeocoder class BaseTestNominatim(BaseTestGeocoder): delta = 0.04 async de...
'Q9202'
assert
string_literal
test/geocoders/nominatim.py
test_extratags
BaseTestNominatim
225
null
geopy/geopy
import datetime import pickle import unittest import pytest from geopy.timezone import Timezone, from_fixed_gmt_offset, from_timezone_name class TimezoneTestCase(unittest.TestCase): timezone_gmt_offset_hours = 3 timezone_name = "Europe/Moscow" # a DST-less timezone def test_create_from_timezone_name(s...
pytz.tzinfo.BaseTzInfo)
self.assertIsInstance
complex_expr
test/test_timezone.py
test_create_from_timezone_name
TimezoneTestCase
28
null
geopy/geopy
import asyncio from unittest.mock import MagicMock, patch, sentinel import pytest from geopy.exc import GeocoderQuotaExceeded, GeocoderServiceError from geopy.extra.rate_limiter import AsyncRateLimiter, RateLimiter def is_async(request): return request.param def auto_async(is_async): if is_async: as...
mock_sleep.call_count
assert
complex_expr
test/extra/rate_limiter.py
test_error_wait_seconds
150
null
geopy/geopy
import pickle import unittest from geopy.location import Location from geopy.point import Point GRAND_CENTRAL_STR = "89 E 42nd St New York, NY 10017" GRAND_CENTRAL_COORDS_STR = "40.752662,-73.9773" GRAND_CENTRAL_COORDS_TUPLE = (40.752662, -73.9773, 0) GRAND_CENTRAL_POINT = Point(GRAND_CENTRAL_COORDS_STR) GRAND_CENT...
2)
self.assertEqual
numeric_literal
test/test_location.py
test_location_len
LocationTestCase
91
null
geopy/geopy
import warnings from unittest.mock import patch import pytest import geopy.geocoders from geopy.exc import ConfigurationError from geopy.geocoders import Nominatim from geopy.point import Point from test.geocoders.util import BaseTestGeocoder class BaseTestNominatim(BaseTestGeocoder): delta = 0.04 async de...
res.raw
assert
complex_expr
test/geocoders/nominatim.py
test_missing_reverse_details
BaseTestNominatim
169
null
geopy/geopy
from geopy.geocoders import Bing from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestBing(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return Bing( api_key=env['BING_KEY'], **kwargs ) async def test_optional_params(self...
"US"
assert
string_literal
test/geocoders/bing.py
test_optional_params
TestBing
78
null
geopy/geopy
import contextlib import os import ssl from unittest.mock import patch from urllib.parse import urljoin from urllib.request import getproxies, urlopen import pytest import geopy.geocoders from geopy.adapters import ( AdapterHTTPError, AioHTTPAdapter, BaseAsyncAdapter, RequestsAdapter, URLLibAdapte...
None
assert
none_literal
test/adapters/each_adapter.py
inject_proxy_to_system_env
86
null
geopy/geopy
import warnings from unittest.mock import patch import pytest import geopy.geocoders from geopy.exc import ConfigurationError from geopy.geocoders import Nominatim from geopy.point import Point from test.geocoders.util import BaseTestGeocoder class BaseTestNominatim(BaseTestGeocoder): delta = 0.04 async de...
"Deutschland"
assert
string_literal
test/geocoders/nominatim.py
test_geocode_language_parameter
BaseTestNominatim
112
null
geopy/geopy
import uuid import pytest from geopy import Point from geopy.exc import GeocoderAuthenticationFailure, GeocoderQueryError from geopy.geocoders import GeoNames from test.geocoders.util import BaseTestGeocoder, env class TestGeoNames(BaseTestGeocoder): delta = 0.04 def make_geocoder(cls, **kwargs): r...
ValueError)
pytest.raises
variable
test/geocoders/geonames.py
test_reverse_nearby_place_name_raises_for_feature_code
TestGeoNames
68
null
geopy/geopy
from geopy.geocoders import TomTom from test.geocoders.util import BaseTestGeocoder, env class BaseTestTomTom(BaseTestGeocoder): async def test_user_agent_custom(self): geocoder = self.make_geocoder( user_agent='my_user_agent/1.0' ) assert geocoder.headers['User-Agent'] ==
'my_user_agent/1.0'
assert
string_literal
test/geocoders/tomtom.py
test_user_agent_custom
BaseTestTomTom
11
null
geopy/geopy
from geopy.geocoders import Photon from geopy.point import Point from test.geocoders.util import BaseTestGeocoder class TestPhoton(BaseTestGeocoder): known_country_de = "Frankreich" known_country_fr = "France" def make_geocoder(cls, **kwargs): return Photon(**kwargs) async def test_reverse(se...
result.address
assert
complex_expr
test/geocoders/photon.py
test_reverse
TestPhoton
55
null
geopy/geopy
import pickle import unittest from geopy.location import Location from geopy.point import Point GRAND_CENTRAL_STR = "89 E 42nd St New York, NY 10017" GRAND_CENTRAL_COORDS_STR = "40.752662,-73.9773" GRAND_CENTRAL_COORDS_TUPLE = (40.752662, -73.9773, 0) GRAND_CENTRAL_POINT = Point(GRAND_CENTRAL_COORDS_STR) GRAND_CENT...
raw)
self.assertEqual
variable
test/test_location.py
_location_properties_test
LocationTestCase
44
null
geopy/geopy
from geopy.geocoders import MapQuest from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestMapQuest(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return MapQuest(api_key=env['MAPQUEST_KEY'], timeout=3, **kwargs) async def test_geocode_limit(self): ...
2
assert
numeric_literal
test/geocoders/mapquest.py
test_geocode_limit
TestMapQuest
54
null
geopy/geopy
from unittest.mock import patch import geopy.geocoders from geopy.geocoders import LiveAddress from test.geocoders.util import BaseTestGeocoder, env class TestUnitLiveAddress: dummy_id = 'DUMMY12345' dummy_token = 'DUMMY67890' def test_user_agent_custom(self): geocoder = LiveAddress( ...
'my_user_agent/1.0'
assert
string_literal
test/geocoders/smartystreets.py
test_user_agent_custom
TestUnitLiveAddress
18
null
geopy/geopy
import warnings from unittest.mock import patch import pytest import geopy.geocoders from geopy.exc import ConfigurationError from geopy.geocoders import Nominatim from geopy.point import Point from test.geocoders.util import BaseTestGeocoder class TestNominatim(BaseTestNominatim): def make_geocoder(cls, **kwar...
Nominatim
assert
variable
test/geocoders/nominatim.py
test_import_deprecated_osm_module
TestNominatim
377
null
geopy/geopy
import unittest from contextlib import ExitStack from unittest.mock import patch, sentinel import pytest import geopy.geocoders import geopy.geocoders.base from geopy.adapters import BaseAsyncAdapter, BaseSyncAdapter from geopy.exc import GeocoderNotFound, GeocoderQueryError from geopy.geocoders import GoogleV3, get_...
None
assert
none_literal
test/geocoders/base.py
test_init_with_none_overrides_default
GeocoderTestCase
98
null
geopy/geopy
import pickle import unittest from geopy.location import Location from geopy.point import Point GRAND_CENTRAL_STR = "89 E 42nd St New York, NY 10017" GRAND_CENTRAL_COORDS_STR = "40.752662,-73.9773" GRAND_CENTRAL_COORDS_TUPLE = (40.752662, -73.9773, 0) GRAND_CENTRAL_POINT = Point(GRAND_CENTRAL_COORDS_STR) GRAND_CENT...
GRAND_CENTRAL_STR)
self.assertEqual
variable
test/test_location.py
_location_properties_test
LocationTestCase
39
null
geopy/geopy
import pytest from geopy.exc import GeocoderQueryError from geopy.geocoders import IGNFrance from test.geocoders.util import BaseTestGeocoder from test.proxy_server import ProxyServerThread class TestIGNFrance(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return IGNFrance( timeout=10 ...
len(departements_spatial)
assert
func_call
test/geocoders/ignfrance.py
test_geocode_filter_by_envelope
TestIGNFrance
138
null
geopy/geopy
import asyncio from unittest.mock import MagicMock, patch, sentinel import pytest from geopy.exc import GeocoderQuotaExceeded, GeocoderServiceError from geopy.extra.rate_limiter import AsyncRateLimiter, RateLimiter def is_async(request): return request.param def auto_async(is_async): if is_async: as...
await auto_async(rl(sentinel.arg))
assert
func_call
test/extra/rate_limiter.py
test_error_wait_seconds
148
null
geopy/geopy
import pytest from geopy import exc from geopy.geocoders import Woosmap from geopy.point import Point from test.geocoders.util import BaseTestGeocoder, env class TestWoosmap(BaseTestGeocoder): def make_geocoder(cls, **kwargs): return Woosmap(api_key=env['WOOSMAP_KEY'], **kwargs) async def test_forma...
'country:FR'
assert
string_literal
test/geocoders/woosmap.py
test_format_components_param
TestWoosmap
42
null
geopy/geopy
import pytest from geopy.exc import ( GeocoderInsufficientPrivileges, GeocoderQuotaExceeded, GeocoderRateLimited, ) from geopy.geocoders import OpenCage from test.geocoders.util import BaseTestGeocoder, env class TestOpenCage(BaseTestGeocoder): testing_tokens = { # https://opencagedata.com/ap...
GeocoderRateLimited)
pytest.raises
variable
test/geocoders/opencage.py
test_rate_limited_error
TestOpenCage
108
null
geopy/geopy
import unittest from contextlib import ExitStack from unittest.mock import patch, sentinel import pytest import geopy.geocoders import geopy.geocoders.base from geopy.adapters import BaseAsyncAdapter, BaseSyncAdapter from geopy.exc import GeocoderNotFound, GeocoderQueryError from geopy.geocoders import GoogleV3, get_...
7
assert
numeric_literal
test/geocoders/base.py
test_call_geocoder_timeout
GeocoderTestCase
130
null
geopy/geopy
from geopy.geocoders import TomTom from test.geocoders.util import BaseTestGeocoder, env class BaseTestTomTom(BaseTestGeocoder): async def test_geocode(self): location = await self.geocode_run( {'query': 'moscow'}, {'latitude': 55.75587, 'longitude': 37.61768}, ) a...
location.address
assert
complex_expr
test/geocoders/tomtom.py
test_geocode
BaseTestTomTom
18
null
geopy/geopy
import warnings from unittest.mock import patch import pytest import geopy.geocoders from geopy.exc import ConfigurationError from geopy.geocoders import Nominatim from geopy.point import Point from test.geocoders.util import BaseTestGeocoder class BaseTestNominatim(BaseTestGeocoder): delta = 0.04 async de...
len(result)
assert
func_call
test/geocoders/nominatim.py
test_limit
BaseTestNominatim
51
null
geopy/geopy
import math import unittest import warnings from geopy.distance import ( EARTH_RADIUS, Distance, GeodesicDistance, GreatCircleDistance, distance, lonlat, ) from geopy.point import Point EARTH_CIRCUMFERENCE = 2 * math.pi * EARTH_RADIUS NORTH_POLE = Point(90, 0) SOUTH_POLE = Point(-90, 0) FIJI =...
8)
self.assertAlmostEqual
numeric_literal
test/test_distance.py
test_should_convert_from_feet
CommonConversionCases
241
null
magic-wormhole/magic-wormhole
import io from collections import namedtuple from unittest import mock from twisted.internet import endpoints, reactor from .._hints import (endpoint_from_hint_obj, parse_hint_argv, parse_tcp_v1_hint, describe_hint_obj, parse_hint, encode_hint, DirectTCPV1Hint, TorTCPV1Hint, ...
r3
assert
variable
src/wormhole/test/test_hints.py
test_comparable
47
null
magic-wormhole/magic-wormhole
from unittest import mock from zope.interface import alsoProvides from twisted.internet.task import Clock from twisted.internet.interfaces import ITransport import pytest_twisted from ...eventual import EventualQueue from ..._interfaces import IDilationConnector from ..._dilation.roles import LEADER, FOLLOWER from ......
c
assert
variable
src/wormhole/test/dilate/test_connection.py
test_bad_prologue
55
null
magic-wormhole/magic-wormhole
import builtins import io import os import re import stat import sys import tempfile import zipfile from functools import partial from textwrap import dedent, fill from click import UsageError from click.testing import CliRunner from humanize import naturalsize from twisted.internet import endpoints, reactor from twis...
d
assert
variable
src/wormhole/test/test_cli.py
test_text_offer
57
null
magic-wormhole/magic-wormhole
import io from twisted.internet import defer from twisted.internet.error import ConnectError from unittest import mock import pytest import pytest_twisted from .._interfaces import ITorManager from ..errors import NoTorError from ..tor_manager import SocksOnlyTor, get_tor @pytest_twisted.ensureDeferred async def te...
TypeError)
pytest.raises
variable
src/wormhole/test/test_tor_manager.py
test_bad_args
28
null
magic-wormhole/magic-wormhole
from unittest import mock from zope.interface import directlyProvides, implementer from twisted.internet.interfaces import ITransport, IHalfCloseableProtocol, IProtocol from twisted.internet.error import ConnectionDone from ..._interfaces import IDilationManager from ..._dilation.subchannel import (SubChannel, ...
hostaddr
assert
variable
src/wormhole/test/dilate/test_subchannel.py
test_subchannel_create
44
null
magic-wormhole/magic-wormhole
import io from binascii import hexlify, unhexlify from nacl.exceptions import CryptoError from nacl.secret import SecretBox from twisted.internet import address, defer, endpoints, error, protocol, task from twisted.internet.defer import gatherResults from twisted.test import proto_helpers from unittest import mock fr...
0
assert
numeric_literal
src/wormhole/test/test_transit.py
test_records_good
963
null
magic-wormhole/magic-wormhole
from unittest import mock from zope.interface import alsoProvides from twisted.internet.task import Clock from twisted.python.failure import Failure from twisted.internet.interfaces import IProtocolFactory from twisted.internet.protocol import Protocol, Factory import pytest import pytest_twisted from ...eventual impo...
"makeConnection"
assert
string_literal
src/wormhole/test/dilate/test_endpoints.py
OFFassert_makeConnection
27
null
magic-wormhole/magic-wormhole
from unittest import mock from .._key import derive_key, derive_phase_key, encrypt_data, decrypt_data from ..util import bytes_to_hexstr, hexstr_to_bytes import pytest def test_derive_phase_key(): m = "588ba9eef353778b074413a0140205d90d7479e36e0dd4ee35bb729d26131ef1" main = hexstr_to_bytes(m) dk11 = deri...
"3af6a61d1a111225cc8968c6ca6265ef" \ "e892065c3ab46de79dda21306b062990"
assert
string_literal
src/wormhole/test/test_keys.py
test_derive_phase_key
33
null
magic-wormhole/magic-wormhole
from zope.interface import alsoProvides from twisted.internet.task import Clock, Cooperator from twisted.internet.interfaces import IStreamServerEndpoint from unittest import mock import pytest import pytest_twisted from ...eventual import EventualQueue from ..._interfaces import ISend, ITerminator, ISubChannel from ....
str
assert
variable
src/wormhole/test/dilate/test_manager.py
test_make_side
265
null
magic-wormhole/magic-wormhole
from itertools import count from twisted.internet import reactor from twisted.internet.threads import deferToThread from unittest import mock from pytest_twisted import ensureDeferred from .._rlcompleter import (CodeInputter, _input_code_with_completion, input_with_completion, warn_readl...
[mock.call("12")]
assert
collection
src/wormhole/test/test_rlcompleter.py
test_call
191
null
magic-wormhole/magic-wormhole
from zope.interface import alsoProvides from twisted.internet.task import Clock, Cooperator from twisted.internet.interfaces import IStreamServerEndpoint from unittest import mock import pytest import pytest_twisted from ...eventual import EventualQueue from ..._interfaces import ISend, ITerminator, ISubChannel from ....
eps
assert
variable
src/wormhole/test/dilate/test_manager.py
test_dilate_first
63
null
magic-wormhole/magic-wormhole
import io import re from twisted.internet.defer import gatherResults from twisted.internet.error import ConnectionRefusedError from unittest import mock from pytest_twisted import ensureDeferred from .. import _rendezvous, wormhole from ..errors import (KeyFormatError, LonelyError, NoKeyError, ...
{}
assert
collection
src/wormhole/test/test_wormhole.py
test_basic
180
null
magic-wormhole/magic-wormhole
from twisted.internet import defer from pytest_twisted import ensureDeferred from .. import xfer_util APPID = "appid" @ensureDeferred async def test_on_code(reactor, mailbox): code = "1-code" data = "data" send_code = [] receive_code = [] d1 = xfer_util.send( reactor, APPID, ...
[code]
assert
collection
src/wormhole/test/test_xfer_util.py
test_on_code
40
null
magic-wormhole/magic-wormhole
import io import re from twisted.internet.defer import gatherResults from twisted.internet.error import ConnectionRefusedError from unittest import mock from pytest_twisted import ensureDeferred from .. import _rendezvous, wormhole from ..errors import (KeyFormatError, LonelyError, NoKeyError, ...
b"pong"
assert
string_literal
src/wormhole/test/test_wormhole.py
test_delegated
85
null
magic-wormhole/magic-wormhole
import io from collections import namedtuple from unittest import mock from twisted.internet import endpoints, reactor from .._hints import (endpoint_from_hint_obj, parse_hint_argv, parse_tcp_v1_hint, describe_hint_obj, parse_hint, encode_hint, DirectTCPV1Hint, TorTCPV1Hint, ...
r2
assert
variable
src/wormhole/test/test_hints.py
test_comparable
46
null
magic-wormhole/magic-wormhole
import typing import pytest import pytest_twisted from zope.interface import implementer from twisted.internet.task import deferLater from twisted.internet.protocol import Factory from twisted.internet.interfaces import IProtocolFactory from ... import create from ...errors import LonelyError from ...eventual import ...
status0)
assert_*
variable
src/wormhole/test/dilate/test_api.py
test_dilation_status
191
null
magic-wormhole/magic-wormhole
import os import sys from unittest import mock from ..cli.public_relay import RENDEZVOUS_RELAY, TRANSIT_RELAY from .common import config def test_send_baseline(): cfg = config("send", "--text", "hi") assert cfg.what is
None
assert
none_literal
src/wormhole/test/test_args.py
test_send_baseline
11
null
magic-wormhole/magic-wormhole
from unittest import mock from .._key import derive_key, derive_phase_key, encrypt_data, decrypt_data from ..util import bytes_to_hexstr, hexstr_to_bytes import pytest def test_decrypt(): k = "ddc543ef8e4629a603d39dd0307a51bb1e7adb9cb259f6b085c91d0842a18679" key = hexstr_to_bytes(k) encrypted = hexstr_to_...
len(encrypted) - 24 - 16
assert
func_call
src/wormhole/test/test_keys.py
test_decrypt
79
null
magic-wormhole/magic-wormhole
import builtins import io import os import re import stat import sys import tempfile import zipfile from functools import partial from textwrap import dedent, fill from click import UsageError from click.testing import CliRunner from humanize import naturalsize from twisted.internet import endpoints, reactor from twis...
5
assert
numeric_literal
src/wormhole/test/test_cli.py
_do_test_directory
154
null
magic-wormhole/magic-wormhole
from unittest import mock from zope.interface import alsoProvides from twisted.internet.task import Clock from twisted.python.failure import Failure from twisted.internet.interfaces import IProtocolFactory from twisted.internet.protocol import Protocol, Factory import pytest import pytest_twisted from ...eventual impo...
hostaddr
assert
variable
src/wormhole/test/dilate/test_endpoints.py
test_listener_early_succeed
198
null
magic-wormhole/magic-wormhole
import io from collections import namedtuple from unittest import mock from twisted.internet import endpoints, reactor from .._hints import (endpoint_from_hint_obj, parse_hint_argv, parse_tcp_v1_hint, describe_hint_obj, parse_hint, encode_hint, DirectTCPV1Hint, TorTCPV1Hint, ...
str(f.value)
assert
func_call
src/wormhole/test/test_hints.py
test_encode_hint
208
null