def test_download_file(self): """ Should download the selected file and put into mapperData""" t = DataForTestingMappers() t.download_test_file("ftp://ftp.nersc.no/pub/python_test_data/ncep/gfs20120328.t00z.master.grbf00", "ncep") self.assertTrue("ncep" in t.mapperData) self.assertEqual(type(t.mapperData["ncep"]), list) for ifile in t.mapperData["ncep"]: self.assertTrue(os.path.exists(ifile))
def test_all_rs2_files(self): testData = DataForTestingMappers() testData.download_all_test_data() for rsfile in testData.mapperData['radarsat2']: # OBS: do not yield functions that have the word 'test' in # their names - these are run automatically by nose... yield self.incidence_angle, rsfile #yield self.export2thredds, rsfile yield self.export, rsfile
def test_download_file(self): ''' Should download the selected file and put into mapperData''' t = DataForTestingMappers() t.download_test_file( 'ftp://ftp.nersc.no/pub/python_test_data/ncep/gfs20120328.t00z.master.grbf00', 'ncep') self.assertTrue('ncep' in t.mapperData) self.assertEqual(type(t.mapperData['ncep']), list) for ifile in t.mapperData['ncep']: self.assertTrue(os.path.exists(ifile))
def test_specific_mapper(self): ''' Should open all downloaded files with automatically selected mapper ''' testData = DataForTestingMappers() testData.download_all_test_data() for mapperName in testData.mapperData: mapperFiles = testData.mapperData[mapperName] for mapperFile in mapperFiles: print mapperName, '->', mapperFile # OBS: do not yield functions that have the word 'test' in # their names - these are run automatically by nose... yield self.open_with_specific_mapper, mapperFile, mapperName
def test_specific_mapper(self): """ Should open all downloaded files with automatically selected mapper """ testData = DataForTestingMappers() testData.download_all_test_data() for mapperName in testData.mapperData: mapperFiles = testData.mapperData[mapperName] for mapperFile in mapperFiles: print mapperName, "->", mapperFile # OBS: do not yield functions that have the word 'test' in # their names - these are run automatically by nose... yield self.open_with_specific_mapper, mapperFile, mapperName
def test_automatic_mapper(self): """ Should open all downloaded files with automatically selected mapper """ testData = DataForTestingMappers() testData.download_all_test_data() for mapper in testData.mapperData: mapperFiles = testData.mapperData[mapper] for mapperFile in mapperFiles: print mapperFile # OBS: do not yield functions that have the word 'test' in # their names - these are run automatically by nose... yield self.open_with_automatic_mapper, mapperFile yield self.geolocation_of_exportedNC_vs_original, mapperFile
def test_automatic_mapper(self): ''' Should open all downloaded files with automatically selected mapper ''' testData = DataForTestingMappers() testData.download_all_test_data() for mapper in testData.mapperData: mapperFiles = testData.mapperData[mapper] for mapperFile in mapperFiles: print mapperFile # OBS: do not yield functions that have the word 'test' in # their names - these are run automatically by nose... yield self.open_with_automatic_mapper, mapperFile yield self.geolocation_of_exportedNC_vs_original, \ mapperFile
def test_all_rs2_files(self): sys.stderr.write('\ntest_all_rs2_files\n') testData = DataForTestingMappers() rs2Index = [i for i, v in enumerate(testData.mapperData) if v[1] == 'radarsat2'] for index in rs2Index: rsfile = testData.mapperData[index][0] # yield self.export2thredds, rsfile yield self.export, rsfile yield self.incidence_angle, rsfile yield self.export_band, rsfile yield self.resize, rsfile
def setup_class(cls): ''' Download testing data ''' cls.testData = DataForTestingMappers()
def test_create_test_data(self): ''' should create TestData instance ''' t = DataForTestingMappers() self.assertTrue(hasattr(t, 'mapperData'))
def test_testDataDir_exists(self): ''' should create TestData instance ''' t = DataForTestingMappers() self.assertTrue(os.path.exists(t.testDataDir))
def test_testDataDir_from_env(self): ''' should create TestData instance ''' fakeDir = '/fake/dir/to/test/data' os.environ['MAPPER_TEST_DATA_DIR'] = fakeDir t = DataForTestingMappers() self.assertEqual(t.testDataDir, fakeDir)