Пример #1
0
 def testInvalid(self):
     """Test that we reject timespans that should not exist.
     """
     with self.assertRaises(ValueError):
         Timespan(TimeConverter().max_time, None)
     with self.assertRaises(ValueError):
         Timespan(TimeConverter().max_time, TimeConverter().max_time)
     with self.assertRaises(ValueError):
         Timespan(None, TimeConverter().epoch)
     with self.assertRaises(ValueError):
         Timespan(TimeConverter().epoch, TimeConverter().epoch)
     t = TimeConverter().nsec_to_astropy(TimeConverter().max_nsec - 1)
     with self.assertRaises(ValueError):
         Timespan(t, t)
     with self.assertRaises(ValueError):
         Timespan.fromInstant(t)
Пример #2
0
 def testFromInstant(self):
     """Test construction of instantaneous timespans.
     """
     self.assertEqual(Timespan.fromInstant(self.timestamps[0]),
                      Timespan(self.timestamps[0], self.timestamps[0]))