def test_distance2coast_source_not_exists_attribute(self): with self.assertRaises(IOError) as err: distance2coast(self.d, distance_src='/path/dos/not/exist') self.assertEqual( 'Distance to the nearest coast product does not exist - ' 'see Nansat documentation to get it (the path is ' '/path/dos/not/exist)', str(err.exception))
def test_distance2coast_source_not_exists_envvar(self, mock_getenv): mock_getenv.return_value = '/path/dos/not/exist' with self.assertRaises(IOError) as err: distance2coast(self.d) self.assertEqual( 'Distance to the nearest coast product does not exist - ' 'see Nansat documentation to get it (the path is ' '/path/dos/not/exist)', str(err.exception))
def test_distance2coast_integration(self, Nansat, os): Nansat.return_value = self.n os.path.exists.return_value = True result = distance2coast(self.d) self.assertEqual(type(result), NANSAT)