diff --git a/tests/test_name_properties.py b/tests/test_name_properties.py
index d7f9a56908b7ee259c5972f4bd41168e6d1e2010..30bcac9807290358cb7133ba7490ce128e0a703e 100644
--- a/tests/test_name_properties.py
+++ b/tests/test_name_properties.py
@@ -221,8 +221,9 @@ def test_query_name_property():
 
     assert db.execute_query("FIND TestPerson WITH TestGivenName='John'",
                             unique=True).id == rec.id
-    with raises(db.EntityDoesNotExistError):
-        assert db.execute_query("FIND John", unique=True)
+    with raises(db.TransactionError) as te:
+        db.execute_query("FIND John", unique=True)
+    assert te.value.has_error(db.EntityDoesNotExistError)
 
     teardown()