Skip to content

Commit bd20cfe

Browse files
authored
Add query type error assertion for java (#441)
* Add query type error assertion for java (#436) * Update test_invalid_query_type test (#442) * Fix B020 Found for loop that reassigns the iterable
1 parent b174993 commit bd20cfe

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

boltstub/bolt_protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ def decode_versions(cls, b):
9090
assert isinstance(b, (bytes, bytearray))
9191
assert len(b) == 16
9292
for spec in (b[i:(i + 4)] for i in range(0, 16, 4)):
93-
_, range_, minor, major = spec
94-
for minor in range(minor, minor - range_ - 1, -1):
93+
_, range_, spec_minor, major = spec
94+
for minor in range(spec_minor, spec_minor - range_ - 1, -1):
9595
yield major, minor
9696

9797
@classmethod

tests/stub/summary/scripts/empty_summary_type_wr.script

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ A: HELLO {"{}": "*"}
44
*: RESET
55
C: RUN "*" "*" "*"
66
S: SUCCESS {"t_first": 2001, "fields": ["n"]}
7-
C: PULL {"n": "*"}
8-
S: RECORD [1]
9-
SUCCESS {"type": "wr", "db": "apple", "t_last": 2002, "stats": {}}
7+
{{
8+
C: PULL {"n": "*"}
9+
S: RECORD [1]
10+
----
11+
C: DISCARD {"n": -1}
12+
}}
13+
S: SUCCESS {"type": "wr", "db": "apple", "t_last": 2002, "stats": {}}
1014
*: RESET
1115
?: GOODBYE

tests/stub/summary/test_summary.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ def _test():
121121
e.exception.errorType,
122122
"<class 'neo4j._exceptions.BoltProtocolError'>"
123123
)
124+
elif get_driver_name() == "java":
125+
self.assertEqual(
126+
e.exception.errorType,
127+
"org.neo4j.driver.exceptions.ProtocolException"
128+
)
124129

125130
for query_type in ("wr",):
126131
with self.subTest(query_type):

0 commit comments

Comments
 (0)