--- /dev/null
+"""
+Test suite for db.julian. Uses unittest module.
+
+2011, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro.
+"""
+
+import unittest
+import os
+import julian
+import datetime
+
+
+class JulianTest(unittest.TestCase):
+ """
+ Test suite for db.julian.
+ """
+
+ def test_stringToJulian(self):
+ jd = julian.stringToJulian("2000-01-01", "12:00:00.00")
+ self.assertTrue(2451544 <= float(jd) and float(jd) <= 2451546)
+
+ def test_julianToDatetime(self):
+ dt = julian.julianToDatetime(2451545)
+ self.assertTrue(dt.year == 2000 and dt.month == 1 and dt.day == 1
+ and dt.hour == 12 and dt.minute == 0 and dt.second == 0)
+
+ def test_both_ways(self):
+ dt = julian.julianToDatetime(2451545)
+ jd = julian.datetimeToJulian(dt)
+ self.assertTrue(2451544 <= float(jd) and float(jd) <= 2451546)
+
+if __name__ == "__main__":
+ unittest.main()