Esempio n. 1
0
 def test_duration_days(self):
     td = config.timedelta_from_duration_string('7 days')
     self.assertEqual(td, timedelta(days=7))
Esempio n. 2
0
 def test_duration_minutes(self):
     td = config.timedelta_from_duration_string('45 minutes')
     self.assertEqual(td, timedelta(minutes=45))
Esempio n. 3
0
 def test_duration_hours(self):
     td = config.timedelta_from_duration_string('3 hours')
     self.assertEqual(td, timedelta(hours=3))
Esempio n. 4
0
 def test_duration_seconds(self):
     td = config.timedelta_from_duration_string('10 seconds')
     self.assertEqual(td, timedelta(seconds=10))
Esempio n. 5
0
 def test_duration_one_second(self):
     td = config.timedelta_from_duration_string('1 second')
     self.assertEqual(td, timedelta(seconds=1))
Esempio n. 6
0
 def test_duration_composite(self):
     td = config.timedelta_from_duration_string(
         '1 hour, 45 minutes, 30 seconds')
     self.assertEqual(td, timedelta(hours=1, minutes=45, seconds=30))
Esempio n. 7
0
 def test_duration_one_second(self):
     td = config.timedelta_from_duration_string('1 second')
     self.assertEqual(td, timedelta(seconds=1))
Esempio n. 8
0
 def test_duration_composite(self):
     td = config.timedelta_from_duration_string(
         '1 hour, 45 minutes, 30 seconds')
     self.assertEqual(td, timedelta(hours=1, minutes=45, seconds=30))
Esempio n. 9
0
 def test_duration_invalid_negative(self):
     with self.assertRaises(ValueError):
         config.timedelta_from_duration_string('-45 hours')
Esempio n. 10
0
 def test_duration_months(self):
     td = config.timedelta_from_duration_string('1 month')
     self.assertEqual(td, timedelta(days=30))
Esempio n. 11
0
 def test_duration_years(self):
     td = config.timedelta_from_duration_string('20 years')
     self.assertEqual(td, timedelta(days=(365 * 20)))
Esempio n. 12
0
 def test_duration_days(self):
     td = config.timedelta_from_duration_string('7 days')
     self.assertEqual(td, timedelta(days=7))
Esempio n. 13
0
 def test_duration_hours(self):
     td = config.timedelta_from_duration_string('3 hours')
     self.assertEqual(td, timedelta(hours=3))
Esempio n. 14
0
 def test_duration_minutes(self):
     td = config.timedelta_from_duration_string('45 minutes')
     self.assertEqual(td, timedelta(minutes=45))
Esempio n. 15
0
 def test_duration_months(self):
     td = config.timedelta_from_duration_string('1 month')
     self.assertEqual(td, timedelta(days=30))
Esempio n. 16
0
 def test_duration_numeric(self):
     td = config.timedelta_from_duration_string('600')
     self.assertEqual(td, timedelta(seconds=600))
Esempio n. 17
0
 def test_duration_years(self):
     td = config.timedelta_from_duration_string('20 years')
     self.assertEqual(td, timedelta(days=(365 * 20)))
Esempio n. 18
0
 def test_duration_numeric(self):
     td = config.timedelta_from_duration_string('600')
     self.assertEqual(td, timedelta(seconds=600))
Esempio n. 19
0
 def test_duration_invalid_negative(self):
     with self.assertRaises(ValueError):
         config.timedelta_from_duration_string('-45 hours')
Esempio n. 20
0
 def test_duration_seconds(self):
     td = config.timedelta_from_duration_string('10 seconds')
     self.assertEqual(td, timedelta(seconds=10))