A library that computes the ephemerides.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

29 lines
801 B

  1. import unittest
  2. from kosmorrolib import dateutil
  3. from datetime import datetime
  4. class DateUtilTestCase(unittest.TestCase):
  5. def test_translate_to_timezone(self):
  6. date = dateutil.translate_to_timezone(datetime(2020, 6, 9, 4), to_tz=-2)
  7. self.assertEqual(2, date.hour)
  8. date = dateutil.translate_to_timezone(datetime(2020, 6, 9, 0), to_tz=2)
  9. self.assertEqual(2, date.hour)
  10. date = dateutil.translate_to_timezone(
  11. datetime(2020, 6, 9, 8), to_tz=2, from_tz=6
  12. )
  13. self.assertEqual(4, date.hour)
  14. date = dateutil.translate_to_timezone(
  15. datetime(2020, 6, 9, 1), to_tz=0, from_tz=2
  16. )
  17. self.assertEqual(8, date.day)
  18. self.assertEqual(23, date.hour)
  19. if __name__ == "__main__":
  20. unittest.main()