Esempio n. 1
0
 def test_build_offset_td(self):
     td = datetime.timedelta(minutes=1)
     self.assertEqual(
         _build_offset(td, {}, None),
         td,
     )
Esempio n. 2
0
 def test_build_offset_kwargs(self):
     kwargs = {'minutes': 1}
     self.assertEqual(
         _build_offset(None, kwargs, None),
         datetime.timedelta(**kwargs),
     )
Esempio n. 3
0
 def test_build_offset_both(self):
     with self.assertRaises(ValueError):
         _build_offset(datetime.timedelta(minutes=1), {'minutes': 1}, None)
Esempio n. 4
0
 def test_build_offset_exc(self):
     with self.assertRaises(TypeError):
         # object() is not an instance of a timedelta.
         _build_offset(object(), {}, None)
Esempio n. 5
0
 def test_build_offset_default(self):
     default = object()
     self.assertIs(default, _build_offset(None, {}, default))