def test_get_duration_resolution_weeks(self): self.assertEqual(get_duration_resolution("P1W"), DurationResolution.Weeks) self.assertEqual(get_duration_resolution("P1,5W"), DurationResolution.Weeks) self.assertEqual(get_duration_resolution("P1.5W"), DurationResolution.Weeks)
def test_get_duration_resolution_seconds(self): self.assertEqual(get_duration_resolution("P1Y2M3DT4H54M6S"), DurationResolution.Seconds) self.assertEqual(get_duration_resolution("P1Y2M3DT4H54M6,5S"), DurationResolution.Seconds) self.assertEqual(get_duration_resolution("P1Y2M3DT4H54M6.5S"), DurationResolution.Seconds) self.assertEqual(get_duration_resolution("PT4H54M6,5S"), DurationResolution.Seconds) self.assertEqual(get_duration_resolution("PT4H54M6.5S"), DurationResolution.Seconds) self.assertEqual(get_duration_resolution("PT0.0000001S"), DurationResolution.Seconds) self.assertEqual(get_duration_resolution("PT2.0000048S"), DurationResolution.Seconds) self.assertEqual(get_duration_resolution("P0003-06-04T12:30:05"), DurationResolution.Seconds) self.assertEqual( get_duration_resolution("P0003-06-04T12:30:05.5"), DurationResolution.Seconds, ) self.assertEqual( get_duration_resolution("P0001-02-03T14:43:59.9999997"), DurationResolution.Seconds, )
def test_get_duration_resolution_years(self): self.assertEqual(get_duration_resolution("P1Y"), DurationResolution.Years) self.assertEqual(get_duration_resolution("P1,5Y"), DurationResolution.Years) self.assertEqual(get_duration_resolution("P1.5Y"), DurationResolution.Years)
def test_get_duration_resolution_months(self): self.assertEqual(get_duration_resolution("P1Y2M"), DurationResolution.Months) self.assertEqual(get_duration_resolution("P1M"), DurationResolution.Months) self.assertEqual(get_duration_resolution("P1,5M"), DurationResolution.Months) self.assertEqual(get_duration_resolution("P1.5M"), DurationResolution.Months)
def test_get_duration_resolution_days(self): self.assertEqual(get_duration_resolution('P1Y2M3D'), DurationResolution.Days) self.assertEqual(get_duration_resolution('P1Y2M3,5D'), DurationResolution.Days) self.assertEqual(get_duration_resolution('P1Y2M3.5D'), DurationResolution.Days) self.assertEqual(get_duration_resolution('P1D'), DurationResolution.Days) self.assertEqual(get_duration_resolution('P1,5D'), DurationResolution.Days) self.assertEqual(get_duration_resolution('P1.5D'), DurationResolution.Days)
def test_get_duration_resolution_minutes(self): self.assertEqual(get_duration_resolution("P1Y2M3DT4H5M"), DurationResolution.Minutes) self.assertEqual(get_duration_resolution("PT4H5M"), DurationResolution.Minutes)
def test_get_duration_resolution_hours(self): self.assertEqual(get_duration_resolution("P1Y2M3DT4H"), DurationResolution.Hours) self.assertEqual(get_duration_resolution("PT4H"), DurationResolution.Hours)