<commit_before>from bingmaps.location import LocationByPoint
from bingmaps import BING_MAPS_KEY
from .fixtures import parametrize

https_protocol = 'https'

DATA = [
    {'queryParameters': {
        'point': '1,2',
        'includeEntityTypes': 'address',
        'key': BING_MAPS_KEY}},
    {'queryParameters': {
        'point': '3,4',
        'includeEntityTypes': 'Neighborhood',
        'key': BING_MAPS_KEY}},
    {'queryParameters': {
        'point': '5,6',
        'includeEntityTypes': 'PopulatedPlace',
        'key': BING_MAPS_KEY}},
    {'queryParameters': {
        'point': '9,10',
        'includeEntityTypes': 'Postcode1',
        'key': BING_MAPS_KEY}},
    {'queryParameters': {
        'point': '1,2',
        'includeEntityTypes': 'AdminDivision1',
        'key': BING_MAPS_KEY}},
    {'queryParameters': {
        'point': '1,2',
        'includeEntityTypes': 'AdminDivision2',
        'key': BING_MAPS_KEY}},
    {'queryParameters': {
        'point': '1,2',
        'includeEntityTypes': 'CountryRegion',
        'key': BING_MAPS_KEY}},
]

EXPECTED = [
    'http://dev.virtualearth.net/REST/v1/Locations/1,2?includeEntityTypes='
    'address&includeNeighborhood=1&include='
    'ciso2&key={0}'.format(BING_MAPS_KEY),
    'http://dev.virtualearth.net/REST/v1/Locations/3,4?includeEntityTypes='
    'Neighborhood&includeNeighborhood=1&include='
    'ciso2&key={0}'.format(BING_MAPS_KEY),
    'http://dev.virtualearth.net/REST/v1/Locations/5,6?includeEntityTypes='
    'PopulatedPlace&includeNeighborhood=1&include='
    'ciso2&key={0}'.format(BING_MAPS_KEY),
    'http://dev.virtualearth.net/REST/v1/Locations/9,10?includeEntityTypes='
    'Postcode1&includeNeighborhood=1&include='
    'ciso2&key={0}'.format(BING_MAPS_KEY),
    'https://dev.virtualearth.net/REST/v1/Locations/1,2?includeEntityTypes='
    'AdminDivision1&includeNeighborhood=1&include='
    'ciso2&key={0}'.format(BING_MAPS_KEY),
    'https://dev.virtualearth.net/REST/v1/Locations/1,2?includeEntityTypes='
    'AdminDivision2&includeNeighborhood=1&include='
    'ciso2&key={0}'.format(BING_MAPS_KEY),
    'https://dev.virtualearth.net/REST/v1/Locations/1,2?includeEntityTypes='
    'CountryRegion&includeNeighborhood=1&include='
    'ciso2&key={0}'.format(BING_MAPS_KEY),
]


@parametrize('data,expected', [
    (DATA[0], EXPECTED[0]),
    (DATA[1], EXPECTED[1]),
    (DATA[2], EXPECTED[2]),
    (DATA[3], EXPECTED[3])
])
def test_location_by_point_url_http_protocol(data, expected):
    loc_by_point = LocationByPoint(data)
    assert loc_by_point.build_url() == expected


@parametrize('data,expected', [
    (DATA[4], EXPECTED[4]),
    (DATA[5], EXPECTED[5]),
    (DATA[6], EXPECTED[6])
])
def test_location_by_point_url_https_protocol(data, expected):
    loc_by_point = LocationByPoint(data, https_protocol)
    assert loc_by_point.build_url() == expected


@parametrize('data,expected', [
    (DATA[0], EXPECTED[0]),
    (DATA[1], EXPECTED[1]),
    (DATA[2], EXPECTED[2]),
    (DATA[3], EXPECTED[3]),
    (DATA[4], EXPECTED[4]),
    (DATA[5], EXPECTED[5]),
    (DATA[6], EXPECTED[6])
])
def test_location_by_point_url_get_data(data, expected):
    loc_by_point = LocationByPoint(data)
    loc_by_point.get_data()
    assert loc_by_point.status_code == 200<commit_msg>Divided data in between http and https protocol<commit_after>from bingmaps.location import LocationByPoint
from bingmaps import BING_MAPS_KEY
from .fixtures import parametrize

https_protocol = 'https'

DATA = [
    {'queryParameters': {
        'point': '1,2',
        'includeEntityTypes': 'address',
        'key': BING_MAPS_KEY}},
    {'queryParameters': {
        'point': '3,4',
        'includeEntityTypes': 'Neighborhood',
        'key': BING_MAPS_KEY}},
    {'queryParameters': {
        'point': '5,6',
        'includeEntityTypes': 'PopulatedPlace',
        'key': BING_MAPS_KEY}},
    {'queryParameters': {
        'point': '9,10',
        'includeEntityTypes': 'Postcode1',
        'key': BING_MAPS_KEY}},
    {'queryParameters': {
        'point': '1,2',
        'includeEntityTypes': 'AdminDivision1',
        'key': BING_MAPS_KEY}},
    {'queryParameters': {
        'point': '1,2',
        'includeEntityTypes': 'AdminDivision2',
        'key': BING_MAPS_KEY}},
    {'queryParameters': {
        'point': '1,2',
        'includeEntityTypes': 'CountryRegion',
        'key': BING_MAPS_KEY}},
]

EXPECTED = [
    'http://dev.virtualearth.net/REST/v1/Locations/1,2?includeEntityTypes='
    'address&includeNeighborhood=1&include='
    'ciso2&key={0}'.format(BING_MAPS_KEY),
    'http://dev.virtualearth.net/REST/v1/Locations/3,4?includeEntityTypes='
    'Neighborhood&includeNeighborhood=1&include='
    'ciso2&key={0}'.format(BING_MAPS_KEY),
    'http://dev.virtualearth.net/REST/v1/Locations/5,6?includeEntityTypes='
    'PopulatedPlace&includeNeighborhood=1&include='
    'ciso2&key={0}'.format(BING_MAPS_KEY),
    'http://dev.virtualearth.net/REST/v1/Locations/9,10?includeEntityTypes='
    'Postcode1&includeNeighborhood=1&include='
    'ciso2&key={0}'.format(BING_MAPS_KEY),
    'https://dev.virtualearth.net/REST/v1/Locations/1,2?includeEntityTypes='
    'AdminDivision1&includeNeighborhood=1&include='
    'ciso2&key={0}'.format(BING_MAPS_KEY),
    'https://dev.virtualearth.net/REST/v1/Locations/1,2?includeEntityTypes='
    'AdminDivision2&includeNeighborhood=1&include='
    'ciso2&key={0}'.format(BING_MAPS_KEY),
    'https://dev.virtualearth.net/REST/v1/Locations/1,2?includeEntityTypes='
    'CountryRegion&includeNeighborhood=1&include='
    'ciso2&key={0}'.format(BING_MAPS_KEY),
]


@parametrize('data,expected', [
    (DATA[0], EXPECTED[0]),
    (DATA[1], EXPECTED[1]),
    (DATA[2], EXPECTED[2]),
    (DATA[3], EXPECTED[3])
])
def test_location_by_point_url_http_protocol(data, expected):
    loc_by_point = LocationByPoint(data)
    assert loc_by_point.build_url() == expected


@parametrize('data,expected', [
    (DATA[4], EXPECTED[4]),
    (DATA[5], EXPECTED[5]),
    (DATA[6], EXPECTED[6])
])
def test_location_by_point_url_https_protocol(data, expected):
    loc_by_point = LocationByPoint(data, https_protocol)
    assert loc_by_point.build_url() == expected
{'fraction_non_alphanumeric': 0.1711828654875872, 'fraction_numerical': 0.028070744767158852, 'mean_word_length': 4.3321799307958475, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4614745', 'n_tokens_mistral': 2278, 'n_tokens_neox': 2215, 'n_words': 268}