def testMaxExposures(self): """Test config.maxExposures """ config = SelectLsstImagesTask.ConfigClass() config.database = Database for maxExposures in (0, 6): config.maxExposures = maxExposures task = SelectLsstImagesTask(config=config) coordList = getCoordList(80.0, -7.9, 81.0, -6.5) filter = "r" expInfoList = task.run(coordList, filter).exposureInfoList self.assertEqual(len(expInfoList), maxExposures)
def testWholeSky(self): """Test whole-sky search """ config = SelectLsstImagesTask.ConfigClass() config.database = Database for maxFwhm in (0.75, 0.80): config.maxFwhm = maxFwhm task = SelectLsstImagesTask(config=config) coordList = None filter = "r" expInfoList = task.run(coordList, filter).exposureInfoList self.assertEqual( tuple(expInfo for expInfo in expInfoList if expInfo.fwhm > maxFwhm), ())
def testMaxFwhm(self): """Test config.maxFwhm """ config = SelectLsstImagesTask.ConfigClass() config.database = Database for maxFwhm in (0.75, 0.80): config.maxFwhm = maxFwhm task = SelectLsstImagesTask(config=config) coordList = getCoordList(80.0, -7.9, 81.0, -6.5) filter = "r" expInfoList = task.run(coordList, filter).exposureInfoList self.assertEqual( tuple(expInfo for expInfo in expInfoList if expInfo.fwhm > maxFwhm), ())
def setUp(self): """Initialize the DB connection. Raise SkipTest if unable to access DB.""" config = SelectLsstImagesTask.ConfigClass() try: DbAuth.username(config.host, str(config.port)), except RuntimeError as e: reason = "Warning: did not find host=%s, port=%s in your db-auth file; or %s " \ "skipping unit tests" % \ (config.host, str(config.port), e) raise unittest.SkipTest(reason)