def test_replace_path_seperator(self): self.assertEquals("", TextUtils.replace_path_seperator("")) self.assertEquals(" ", TextUtils.replace_path_seperator(" ")) self.assertEquals(os.sep, TextUtils.replace_path_seperator("/")) self.assertEquals(".." + os.sep, TextUtils.replace_path_seperator("../")) self.assertEquals("\\", TextUtils.replace_path_seperator("/", "/", "\\"))
import os from programy.utils.text.text import TextUtils from programy.utils.geo.geonames import GeoNamesApi from programy.utils.license.keys import LicenseKeys if __name__ == '__main__': # Only to be used to create test data for unit aiml_tests license_keys = LicenseKeys() license_keys.load_license_key_file(os.path.dirname(__file__) + TextUtils.replace_path_seperator('/../../../../bots/y-bot/config/license.keys')) geonamesapi = GeoNamesApi(license_keys) # Running these tools drops test files into the geocode test folder geonamesapi.store_get_latlong_for_postcode_to_file("KY39UR", TextUtils.replace_path_seperator("../../../test/utils/geocode/geonames_latlong.json")) geonamesapi.store_get_latlong_for_postcode_to_file("KY39UR", TextUtils.replace_path_seperator("../../../test/utils/geo/geonames_latlong.json")) # Only to be used to create test data for unit aiml_tests
import os from programy.utils.text.text import TextUtils from programy.utils.geo.google import GoogleMaps from programy.utils.license.keys import LicenseKeys if __name__ == '__main__': license_keys = LicenseKeys() license_keys.load_license_key_file(os.path.dirname(__file__) + TextUtils.replace_path_seperator('/../../../../bots/y-bot/config/license.keys')) # Only to be used to create test data for unit aiml_tests googlemaps = GoogleMaps(license_keys) # Running these tools drops test files into the geocode test folder googlemaps.store_get_latlong_for_location_to_file("KY3 9UR", TextUtils.replace_path_seperator( "../../../test/utils/geo/google_latlong.json")) googlemaps.store_get_distance_between_addresses_as_file("Edinburgh", "Kinghorn", TextUtils.replace_path_seperator( "../../../test/utils/geo/distance.json")) googlemaps.store_get_directions_between_addresses_as_file("Edinburgh", "Kinghorn", TextUtils.replace_path_seperator( "../../../test/utils/geo/directions.json")) googlemaps.store_get_latlong_for_location_to_file("KY3 9UR", TextUtils.replace_path_seperator( "../../../test/utils/weather/google_latlong.json")) googlemaps.store_get_distance_between_addresses_as_file("Edinburgh", "Kinghorn", TextUtils.replace_path_seperator( "../../../test/utils/weather/distance.json")) googlemaps.store_get_directions_between_addresses_as_file("Edinburgh", "Kinghorn", TextUtils.replace_path_seperator( "../../../test/utils/weather/directions.json")) # Only to be used to create test data for unit aiml_tests
units="imperial"): response = self._get_directions_between_addresses_response( origin, destination, country, mode, units) with open(filename, "w+") as data_file: json.dump(response, data_file, sort_keys=True, indent=2) if __name__ == '__main__': # Only to be used to create test data for unit aiml_tests googlemaps = GoogleMaps() # Running these tools drops test files into the geocode test folder googlemaps.store_get_latlong_for_location_to_file( "KY3 9UR", TextUtils.replace_path_seperator( "../../../test/utils/geo/google_latlong.json")) googlemaps.store_get_distance_between_addresses_as_file( "Edinburgh", "Kinghorn", TextUtils.replace_path_seperator( "../../../test/utils/geo/distance.json")) googlemaps.store_get_directions_between_addresses_as_file( "Edinburgh", "Kinghorn", TextUtils.replace_path_seperator( "../../../test/utils/geo/directions.json")) googlemaps.store_get_latlong_for_location_to_file( "KY3 9UR", TextUtils.replace_path_seperator( "../../../test/utils/weather/google_latlong.json")) googlemaps.store_get_distance_between_addresses_as_file( "Edinburgh", "Kinghorn",
def test_replace_path_seperator(self): self.assertEquals("", TextUtils.replace_path_seperator("")) self.assertEquals(" ", TextUtils.replace_path_seperator(" ")) self.assertEquals(os.sep, TextUtils.replace_path_seperator("/")) self.assertEquals(".."+os.sep, TextUtils.replace_path_seperator("../")) self.assertEquals("\\", TextUtils.replace_path_seperator("/", "/", "\\"))
'postalCodes'][0]: raise Exception("Invalid/Unknown post code") return LatLong(data['postalCodes'][0]['lat'], data['postalCodes'][0]['lng']) if __name__ == '__main__': # Only to be used to create test data for unit aiml_tests from programy.utils.license.keys import LicenseKeys license_keys = LicenseKeys() license_keys.load_license_key_file( os.path.dirname(__file__) + TextUtils.replace_path_seperator( '/../../../../bots/y-bot/config/license.keys')) geonamesapi = GeoNamesApi(license_keys) # Running these tools drops test files into the geocode test folder geonamesapi.store_get_latlong_for_postcode_to_file( "KY39UR", TextUtils.replace_path_seperator( "../../../test/utils/geocode/geonames_latlong.json")) geonamesapi.store_get_latlong_for_postcode_to_file( "KY39UR", TextUtils.replace_path_seperator( "../../../test/utils/geo/geonames_latlong.json")) # Only to be used to create test data for unit aiml_tests
import os from programy.utils.text.text import TextUtils from programy.utils.geo.google import GoogleMaps from programy.utils.license.keys import LicenseKeys if __name__ == '__main__': license_keys = LicenseKeys() license_keys.load_license_key_file( os.path.dirname(__file__) + TextUtils.replace_path_seperator( '/../../../../bots/y-bot/config/license.keys')) # Only to be used to create test data for unit aiml_tests googlemaps = GoogleMaps(license_keys) # Running these tools drops test files into the geocode test folder googlemaps.store_get_latlong_for_location_to_file( "KY3 9UR", TextUtils.replace_path_seperator( "../../../test/utils/geo/google_latlong.json")) googlemaps.store_get_distance_between_addresses_as_file( "Edinburgh", "Kinghorn", TextUtils.replace_path_seperator( "../../../test/utils/geo/distance.json")) googlemaps.store_get_directions_between_addresses_as_file( "Edinburgh", "Kinghorn", TextUtils.replace_path_seperator( "../../../test/utils/geo/directions.json")) googlemaps.store_get_latlong_for_location_to_file(