Skip to content

Commit 3f6a670

Browse files
authored
3rd round of migrating integration tests to testkit (#567)
1 parent 30613cc commit 3f6a670

File tree

7 files changed

+145
-376
lines changed

7 files changed

+145
-376
lines changed

testkitbackend/fromtestkit.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ def to_param(m):
5252
"""
5353
value = m["data"]["value"]
5454
name = m["name"]
55+
if name == "CypherNull":
56+
return None
5557
if name == "CypherString":
5658
return str(value)
5759
if name == "CypherBool":
@@ -62,8 +64,8 @@ def to_param(m):
6264
return float(value)
6365
if name == "CypherString":
6466
return str(value)
65-
if name == "CypherNull":
66-
return None
67+
if name == "CypherBytes":
68+
return bytearray([int(byte, 16) for byte in value.split()])
6769
if name == "CypherList":
6870
return [to_param(v) for v in value]
6971
if name == "CypherMap":

testkitbackend/totestkit.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
17+
import math
18+
1719
from neo4j.graph import (
1820
Node,
1921
Path,
@@ -39,6 +41,10 @@ def to(name, val):
3941
if isinstance(v, int):
4042
return to("CypherInt", v)
4143
if isinstance(v, float):
44+
if math.isinf(v):
45+
return to("CypherFloat", "+Infinity" if v > 0 else "-Infinity")
46+
if math.isnan(v):
47+
return to("CypherFloat", "NaN")
4248
return to("CypherFloat", v)
4349
if isinstance(v, str):
4450
return to("CypherString", v)
@@ -52,6 +58,8 @@ def to(name, val):
5258
for k, v in v.items():
5359
mp[k] = field(v)
5460
return to("CypherMap", mp)
61+
if isinstance(v, (bytes, bytearray)):
62+
return to("CypherBytes", " ".join("{:02x}".format(byte) for byte in v))
5563
if isinstance(v, Node):
5664
node = {
5765
"id": field(v.id),

tests/integration/test_bookmarking.py

Lines changed: 0 additions & 69 deletions
This file was deleted.

tests/integration/test_core_types.py

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)