Beispiel #1
0
 def test_time_array(self):
     self.assert_supports_temporal_types()
     with self.driver.session() as session:
         data = [Time(12, 34, 56), Time(10, 0, 0)]
         value = session.write_transaction(run_and_rollback,
                                           "CREATE (a {x:$x}) RETURN a.x",
                                           x=data)
         self.assertEqual(value, data)
Beispiel #2
0
 def test_nanosecond_resolution_localtime(self):
     self.assert_supports_temporal_types()
     with self.driver.session() as session:
         result = session.run("RETURN localtime('12:34:56.789012345')")
         value = result.single().value()
         self.assertIsInstance(value, Time)
         self.assertEqual(value, Time(12, 34, 56.789012345))
Beispiel #3
0
 def test_whole_second_time(self):
     self.assert_supports_temporal_types()
     with self.driver.session() as session:
         result = session.run("RETURN time('12:34:56')")
         value = result.single().value()
         self.assertIsInstance(value, Time)
         self.assertEqual(value, Time(12, 34, 56, tzinfo=FixedOffset(0)))
Beispiel #4
0
 def test_time_with_numeric_time_offset(self):
     self.assert_supports_temporal_types()
     with self.driver.session() as session:
         result = session.run("RETURN time('12:34:56.789012345+0130')")
         value = result.single().value()
         self.assertIsInstance(value, Time)
         self.assertEqual(value, Time(12, 34, 56.789012345, tzinfo=FixedOffset(90)))
Beispiel #5
0
 def test_whole_second_time(self):
     self.assert_supports_temporal_types()
     with self.driver.session() as session:
         result = session.run("CYPHER runtime=interpreted WITH $x AS x "
                              "RETURN x.hour, x.minute, x.second",
                              x=Time(12, 34, 56))
         hour, minute, second = result.single()
         self.assertEqual(hour, 12)
         self.assertEqual(minute, 34)
         self.assertEqual(second, 56)
Beispiel #6
0
 def test_time_with_numeric_time_offset(self):
     self.assert_supports_temporal_types()
     with self.driver.session() as session:
         result = session.run("CYPHER runtime=interpreted WITH $x AS x "
                              "RETURN x.hour, x.minute, x.second, x.nanosecond, x.offset",
                              x=Time(12, 34, 56.789012345, tzinfo=FixedOffset(90)))
         hour, minute, second, nanosecond, offset = result.single()
         self.assertEqual(hour, 12)
         self.assertEqual(minute, 34)
         self.assertEqual(second, 56)
         self.assertEqual(nanosecond, 789012345)
         self.assertEqual(offset, "+01:30")