Ejemplo n.º 1
0
 def test_date(self):
     self.assert_supports_temporal_types()
     with self.driver.session() as session:
         result = session.run("RETURN date('1976-06-13')")
         value = result.single().value()
         self.assertIsInstance(value, Date)
         self.assertEqual(value, Date(1976, 6, 13))
Ejemplo n.º 2
0
 def test_date_array(self):
     self.assert_supports_temporal_types()
     with self.driver.session() as session:
         data = [DateTime.now().date(), Date(1976, 6, 13)]
         value = session.write_transaction(run_and_rollback,
                                           "CREATE (a {x:$x}) RETURN a.x",
                                           x=data)
         self.assertEqual(value, data)
Ejemplo n.º 3
0
 def test_mixed_array(self):
     self.assert_supports_temporal_types()
     with self.driver.session() as session:
         data = [Date(1976, 6, 13), Duration(9, 8, 7, 6, 5, 4)]
         with self.assertRaises(CypherTypeError):
             _ = session.write_transaction(run_and_rollback,
                                           "CREATE (a {x:$x}) RETURN a.x",
                                           x=data)
Ejemplo n.º 4
0
 def test_date(self):
     self.assert_supports_temporal_types()
     with self.driver.session() as session:
         result = session.run("CYPHER runtime=interpreted WITH $x AS x "
                              "RETURN x.year, x.month, x.day",
                              x=Date(1976, 6, 13))
         year, month, day = result.single()
         self.assertEqual(year, 1976)
         self.assertEqual(month, 6)
         self.assertEqual(day, 13)