def test_as_but_no_rate(self): tv = TimeValue(TimeOffset(4)) with self.assertRaises(ValueError): tv.as_count() tv = TimeValue(100) with self.assertRaises(ValueError): tv.as_timeoffset()
def test_as_timeoffset(self): tv = TimeValue(TimeOffset(4), rate=Fraction(25)) to = tv.as_timeoffset() self.assertIsInstance(to, TimeOffset) self.assertEqual(to, TimeOffset(4)) tv = TimeValue(Timestamp(4), rate=Fraction(25)) to = tv.as_timeoffset() self.assertIsInstance(to, TimeOffset) self.assertEqual(to, TimeOffset(4)) tv = TimeValue(100, rate=Fraction(25)) to = tv.as_timeoffset() self.assertIsInstance(to, TimeOffset) self.assertEqual(to, TimeOffset(4))