Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions test/integration/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from unittest import SkipTest
from uuid import uuid4

Expand Down Expand Up @@ -434,7 +433,21 @@ def test_should_sync_after_rollback(self):
assert len(buffer) == 1
assert buffer[0][0] == 1

def test_errors_on_run(self):
def test_errors_on_write_transaction(self):
session = self.driver.session()
with self.assertRaises(TypeError):
session.write_transaction(lambda tx, uuid : tx.run("CREATE (a:Thing {uuid:$uuid})", uuid=uuid), uuid4())
session.close()

def test_errors_on_run_transaction(self):
session = self.driver.session()
tx = session.begin_transaction()
with self.assertRaises(TypeError):
tx.run("CREATE (a:Thing {uuid:$uuid})", uuid=uuid4())
tx.rollback()
session.close()

def test_errors_on_run_session(self):
session = self.driver.session()
session.close()
with self.assertRaises(SessionError):
Expand Down
10 changes: 5 additions & 5 deletions test/unit/test_packstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from io import BytesIO
from math import pi
from unittest import TestCase
from uuid import uuid4

from neo4j.bolt.io import MessageFrame as PyMessageFrame
from neo4j.packstream.packer import Packer as PyPacker
Expand Down Expand Up @@ -273,19 +274,18 @@ def test_map_stream(self):
(unpacked, unpacked_value))

def test_illegal_signature(self):
try:
with self.assertRaises(ValueError):
self.assert_packable((b"XXX", ()), b"\xB0XXX")
except ValueError:
assert True
else:
assert False

def test_empty_struct(self):
self.assert_packable((b"X", ()), b"\xB0X")

def test_tiny_struct(self):
self.assert_packable((b"Z", (u"A", 1)), b"\xB2Z\x81A\x01")

def test_illegal_uuid(self):
with self.assertRaises(ValueError):
self.assert_packable(uuid4(), b"\xB0XXX")

try:
from neo4j.bolt._io import MessageFrame as CMessageFrame
Expand Down