示例#1
0
 def test_durationString(self):
     self.assertEqual('PT0H0M1S', durationString(1))
     self.assertEqual('PT0H1M0S', durationString(60))
     self.assertEqual('PT0H1M1S', durationString(61))
     self.assertEqual(
         'P0Y0M3DT5H13M17S',
         durationString(3600 * 24 * 3 + 3600 * 5 + 60 * 13 + 17))
     self.assertEqual(
         '-P0Y0M3DT5H13M17S',
         durationString((3600 * 24 * 3 + 3600 * 5 + 60 * 13 + 17) * -1))
     self.assertEqual('PT0H0M0.1S', durationString(0.1))
     self.assertEqual('-PT0H0M0.000001S', durationString(-0.000001))
 def toXML(pyValue):
     return isoduration.durationString(pyValue)