diff --git a/test/integration/test_session.py b/test/integration/test_session.py index 14b1ad73f..e17fca0f6 100644 --- a/test/integration/test_session.py +++ b/test/integration/test_session.py @@ -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 @@ -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): diff --git a/test/unit/test_packstream.py b/test/unit/test_packstream.py index 33f733cc7..f6ad601bb 100644 --- a/test/unit/test_packstream.py +++ b/test/unit/test_packstream.py @@ -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 @@ -273,12 +274,8 @@ 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") @@ -286,6 +283,9 @@ def test_empty_struct(self): 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