Exemplo n.º 1
0
 def test_parse_timestamp_to_o_timestamp(self):
     o_timestamp = OTimestamp.parse("April 10 1970 12:25:55")
     self.assertEqual(o_timestamp.get_year(), 1970)
     self.assertEqual(o_timestamp.get_month(), 4)
     self.assertEqual(o_timestamp.get_day_of_month(), 10)
     self.assertEqual(o_timestamp.get_hour(), 12)
     self.assertEqual(o_timestamp.get_minute(), 25)
     self.assertEqual(o_timestamp.get_second(), 55)
Exemplo n.º 2
0
 def generate_o_types(str_type, str_value):
     if str_type == '$interval':
         from ojai.types.OInterval import OInterval
         return OInterval(milli_seconds=str_value)
     elif str_type == '$date':
         from ojai.types.OTimestamp import OTimestamp
         return OTimestamp.parse(str_value)
     elif str_type == '$dateDay':
         from ojai.types.ODate import ODate
         return ODate.parse(str_value)
     else:
         from ojai.types.OTime import OTime
         return OTime.parse(str_value)