Exemplo n.º 1
0
 def test_create_from_time_with_hour(self):
     with Pendulum.test(Pendulum(2016, 8, 11, 12, 34, 56, 123456)):
         d = Pendulum.create_from_time(23)
         self.assertEqual(23, d.hour)
         self.assertEqual(34, d.minute)
         self.assertEqual(56, d.second)
         self.assertEqual(123456, d.microsecond)
Exemplo n.º 2
0
 def test_create_from_time_with_defaults(self):
     d = Pendulum.create_from_time()
     self.assertEqual(d.timestamp, Pendulum.utcnow().timestamp)
     self.assertEqual('UTC', d.timezone_name)
Exemplo n.º 3
0
 def test_create_from_time_with_timezone(self):
     d = Pendulum.create_from_time(23, 5, 11, tz=timezone('Europe/London'))
     now = Pendulum.now('Europe/London')
     self.assertPendulum(d, now.year, now.month, now.day, 23, 5, 11)
     self.assertEqual('Europe/London', d.timezone_name)
Exemplo n.º 4
0
 def test_create_from_time_with_second(self):
     d = Pendulum.create_from_time(second=11)
     self.assertEqual(11, d.second)
Exemplo n.º 5
0
 def test_create_from_time_with_minute(self):
     d = Pendulum.create_from_time(minute=5)
     self.assertEqual(5, d.minute)
 def test_create_from_time_with_timezone(self):
     d = Pendulum.create_from_time(23, 5, 11, tz=pytz.timezone('Europe/London'))
     now = Pendulum.now('Europe/London')
     self.assertPendulum(d, now.year, now.month, now.day, 23, 5, 11)
     self.assertEqual('Europe/London', d.timezone_name)
Exemplo n.º 7
0
 def test_create_from_time(self):
     d = Pendulum.create_from_time(23, 5, 11)
     now = Pendulum.utcnow()
     self.assertPendulum(d, now.year, now.month, now.day, 23, 5, 11)
     self.assertEqual('UTC', d.timezone_name)
 def test_create_from_time_with_second(self):
     d = Pendulum.create_from_time(second=11)
     self.assertEqual(11, d.second)
 def test_create_from_time_with_minute(self):
     d = Pendulum.create_from_time(minute=5)
     self.assertEqual(5, d.minute)
 def test_create_from_time_with_hour(self):
     d = Pendulum.create_from_time(23)
     self.assertEqual(23, d.hour)
     self.assertEqual(0, d.minute)
     self.assertEqual(0, d.second)
     self.assertEqual(0, d.microsecond)
 def test_create_from_time(self):
     d = Pendulum.create_from_time(23, 5, 11)
     now = Pendulum.utcnow()
     self.assertPendulum(d, now.year, now.month, now.day, 23, 5, 11)
     self.assertEqual('UTC', d.timezone_name)
 def test_create_from_time_with_defaults(self):
     d = Pendulum.create_from_time()
     self.assertEqual(d.timestamp, Pendulum.now().timestamp)
     self.assertEqual('UTC', d.timezone_name)