Пример #1
0
    def testMirror(self):
        pos = sesame.object2pos("NGC4258", mirror="cds")
        self.assertTrue(pos is not None)
        self.assertFalse(isinstance(pos, list))
        self.assertTrue(isinstance(pos, tuple))
        self.assertEquals(2, len(pos))
        self.assertTrue(all(map(lambda p: isinstance(p,float), pos)))
        self.assertAlmostEquals(184.74008333, pos[0])
        self.assertAlmostEquals(47.30371944, pos[1])

        pos = sesame.object2pos("NGC4258", mirror="cfa")
        self.assertTrue(pos is not None)
        self.assertFalse(isinstance(pos, list))
        self.assertTrue(isinstance(pos, tuple))
        self.assertEquals(2, len(pos))
        self.assertTrue(all(map(lambda p: isinstance(p,float), pos)))
        self.assertAlmostEquals(184.74008333, pos[0])
        self.assertAlmostEquals(47.30371944, pos[1])

        self.assertRaises(LookupError, sesame.object2pos, "NGC4258", 
                          mirror="ncsa")
Пример #2
0
    def testDefault(self):
        pos = sesame.object2pos("NGC4258")
        self.assertTrue(pos is not None)
        self.assertFalse(isinstance(pos, list))
        self.assertTrue(isinstance(pos, tuple))
        self.assertEquals(2, len(pos))
        self.assertTrue(all(map(lambda p: isinstance(p,float), pos)))
        self.assertAlmostEquals(184.74008333, pos[0])
        self.assertAlmostEquals(47.30371944, pos[1])

        pos = sesame.object2pos(["NGC4258", "M51"])
        self.assertTrue(pos is not None)
        self.assertTrue(isinstance(pos, list))
        self.assertTrue(isinstance(pos[0], tuple))
        self.assertTrue(isinstance(pos[1], tuple))
        self.assertEquals(2, len(pos[1]))
        self.assertAlmostEquals(184.74008333, pos[0][0])
        self.assertAlmostEquals(47.30371944, pos[0][1])

        pos = sesame.object2pos(["NGC4258"])
        self.assertTrue(pos is not None)
        self.assertTrue(isinstance(pos, list))
Пример #3
0
 def testDb(self):
     pos = sesame.object2pos("NGC4258", "V")
     self.assertTrue(pos is not None)
     self.assertAlmostEquals(184.73, pos[0], places=2)
     self.assertAlmostEquals(47.31, pos[1], places=2)