def test_fucking_json(): data = get_json() london = data['features'][0] wellington = data['features'][1] athens = data['features'][2] wellington_distance = calc_points(london['geometry']['coordinates'], wellington['geometry']['coordinates']) athens_distance = calc_points(london['geometry']['coordinates'], athens['geometry']['coordinates']) assert compare_distance(athens_distance, wellington_distance) == 0
def test_get_json(self): """ """ url = 'https://challenges.hackajob.co/swapi/api/people/' self.assertEqual(len(main.get_json(url)), 4)
def test_get_json(self): 'Retrieves data from URL and checks length' data = main.get_json( "https://raw.githubusercontent.com/openfootball/football.json/master/2014-15/en.1.json" ) self.assertEqual(len(data), 2)
def test_get_three_random_features(): data = get_json() features = get_three_random_features(data) assert isinstance(features[0]['properties']["name"], str) assert len(features) == 3
def test_get_features(): data = get_json() assert isinstance(data['features'], list) assert isinstance(data['features'][0]['properties']['name'], str)