File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import pytest
4+
35try :
46 from tools .python_api .test .type_aliases import ConnDB
57except ImportError :
@@ -129,6 +131,27 @@ def test_int8_type_sniffing(conn_db_readwrite: ConnDB) -> None:
129131 result .close ()
130132
131133
134+ def test_issue_483_numpy_ndarray_parameter (conn_db_readwrite : ConnDB ) -> None :
135+ np = pytest .importorskip ("numpy" )
136+
137+ conn , _ = conn_db_readwrite
138+ conn .execute ("CREATE NODE TABLE T(id INT64, v FLOAT[3], PRIMARY KEY(id))" )
139+ conn .execute ("CREATE (:T {id: 1})" )
140+
141+ arr = np .array ([0.1 , 0.2 , 0.3 ], dtype = np .float32 )
142+ result = conn .execute (
143+ "MATCH (n:T {id: 1}) SET n.v = $v RETURN n.v" ,
144+ {"v" : arr },
145+ )
146+
147+ assert result .has_next ()
148+ assert result .get_next () == [
149+ [pytest .approx (0.1 ), pytest .approx (0.2 ), pytest .approx (0.3 )]
150+ ]
151+ assert not result .has_next ()
152+ result .close ()
153+
154+
132155# TODO(Maxwell): check if we should change getCastCost() for the following test
133156# def test_issue_3248(conn_db_readwrite: ConnDB) -> None:
134157# conn, _ = conn_db_readwrite
You can’t perform that action at this time.
0 commit comments