Exemplo n.º 1
0
  def extract(context: TemporalAttributeParsingContext, xml_element) -> typing.Optional[Fraction]:

    dur_raw = xml_element.attrib.get(DurAttribute.qn)

    try:

      return utils.parse_time_expression(context.tick_rate, context.frame_rate, dur_raw) if dur_raw is not None else None

    except ValueError:

      LOGGER.error("bad dur value")

      return None
Exemplo n.º 2
0
 def test_bad_syntax(self):
     with self.assertRaises(ValueError):
         parse_time_expression(60, 24, "100:00:00;01")
Exemplo n.º 3
0
 def test_bad_frame_count(self):
     with self.assertRaises(ValueError):
         parse_time_expression(None, 24, "100:00:00:100")
Exemplo n.º 4
0
 def test_timing_expressions(self):
     for test in self.tests:
         with self.subTest(test[0]):
             c = parse_time_expression(test[2], test[1], test[0])
             self.assertEqual(c, test[3])
             self.assertTrue(isinstance(c, Fraction))