def test_dec_check_toosmall(self): """Check that Dec is forced to have reasonable values""" args = self.parser.parse_args(['--ra', str(self.skypos[0]), '--dec', str(-100), '-a', str(self.radius)]) with self.assertRaises(SystemExit): ga_check_args(args)
def test_ra_check_toobig(self): """Check that RA is forced to have reasonable values""" args = self.parser.parse_args(['--ra', str(400), '--dec', str(self.skypos[1]), '-a', str(self.radius)]) with self.assertRaises(SystemExit): ga_check_args(args)
def test_both_skypos(self): """Check that not _both_ RA/Dec and skypos are specified.""" args = self.parser.parse_args(['--ra', str(self.skypos[0]), '--dec', str(self.skypos[1]), '--skypos', str([self.skypos[0]+1, self.skypos[1]])]) with self.assertRaises(SystemExit): ga_check_args(args)
def test_both_skypos(self): """Check that not _both_ RA/Dec and skypos are specified.""" args = self.parser.parse_args([ '--ra', str(self.skypos[0]), '--dec', str(self.skypos[1]), '--skypos', str([self.skypos[0] + 1, self.skypos[1]]) ]) with self.assertRaises(SystemExit): ga_check_args(args)
def test_dec_check_toosmall(self): """Check that Dec is forced to have reasonable values""" args = self.parser.parse_args([ '--ra', str(self.skypos[0]), '--dec', str(-100), '-a', str(self.radius) ]) with self.assertRaises(SystemExit): ga_check_args(args)
def test_ra_check_toobig(self): """Check that RA is forced to have reasonable values""" args = self.parser.parse_args([ '--ra', str(400), '--dec', str(self.skypos[1]), '-a', str(self.radius) ]) with self.assertRaises(SystemExit): ga_check_args(args)
def test_skypos_propagate(self): """Check that RA/Dec are propagated to skypos.""" args = self.parser.parse_args(['--ra', str(self.skypos[0]), '--dec', str(self.skypos[1]), '-a', str(self.radius)]) args = ga_check_args(args) self.assertAlmostEqual(args.skypos[0], self.skypos[0]) self.assertAlmostEqual(args.skypos[1], self.skypos[1])
def test_annulus_propagate2(self): """Check that annulus propagates to inner and outer.""" args = self.parser.parse_args(['--skypos', str(self.skypos), '-a', str(self.radius), '--annulus', str(self.annulus)]) args = ga_check_args(args) self.assertAlmostEqual(self.annulus[0], args.annulus1) self.assertAlmostEqual(self.annulus[1], args.annulus2) self.assertAlmostEqual(self.annulus[0], args.annulus[0]) self.assertAlmostEqual(self.annulus[1], args.annulus[1])
def test_skypos_propagate(self): """Check that RA/Dec are propagated to skypos.""" args = self.parser.parse_args([ '--ra', str(self.skypos[0]), '--dec', str(self.skypos[1]), '-a', str(self.radius) ]) args = ga_check_args(args) self.assertAlmostEqual(args.skypos[0], self.skypos[0]) self.assertAlmostEqual(args.skypos[1], self.skypos[1])
def test_annulus_propagate2(self): """Check that annulus propagates to inner and outer.""" args = self.parser.parse_args([ '--skypos', str(self.skypos), '-a', str(self.radius), '--annulus', str(self.annulus) ]) args = ga_check_args(args) self.assertAlmostEqual(self.annulus[0], args.annulus1) self.assertAlmostEqual(self.annulus[1], args.annulus2) self.assertAlmostEqual(self.annulus[0], args.annulus[0]) self.assertAlmostEqual(self.annulus[1], args.annulus[1])
def test_no_radius(self): """Check that the aperture radius is mandatory.""" args = self.parser.parse_args(['--skypos', str(self.skypos)]) with self.assertRaises(SystemExit): ga_check_args(args)
def test_no_skypos2(self): """Check that either RA/Dec or skypos is specified""" args = self.parser.parse_args(['--ra', str(self.skypos[0])]) with self.assertRaises(SystemExit): ga_check_args(args)