def test_find_address_err_mess(): """Error message provides lat & lon in correct order.""" try: utils.find_address(lat=40, lon=-200) except ValueError as err: message = str(err) assert ("lat=40" in message) and ("lon=-200" in message)
def __init__(self, lat, lon): """Initialize a Watershed object :param lon: Longitude of point in decimal degrees. :type lon: float :param lat: Latitude of point in decimal degrees. :type lat: float :param simplify: Whether to simplify the polygon representation. :type simplify: bool """ self.lat, self.lon = lat, lon self.state = utils.find_state(utils.find_address(lat=lat, lon=lon)) self.data = self._delineate() self.workspace = self.data['workspaceID'] self.parameters = self.data['parameters']
def test_canada_raises_errors(): """Points outside the U.S. should raise errors.""" with pytest.raises(AssertionError): utils.find_address(lat=45.5017, lon=-73.5673)
def test_find_state(): """Verify that the correct state is returned.""" address = utils.find_address(lat=40.0076, lon=-105.2659) state = utils.find_state(address) assert state == 'CO'
def test_find_address(): """Verify that addresses are retrieved.""" address = utils.find_address(lat=40.0076, lon=-105.2659) assert address['city'] == 'Boulder' assert address['state'] == 'Colorado'
def address(): """A fixture for the address of Boulder, CO.""" return utils.find_address(lat=40.0076, lon=-105.2659)