diff --git a/tests/test_datatype.py b/tests/test_datatype.py
index a996004167bba6bb5bb0f12387b53381036851e5..5fbe5dd2bb1fb5da4919741a9ed37055231ad1fa 100644
--- a/tests/test_datatype.py
+++ b/tests/test_datatype.py
@@ -178,11 +178,10 @@ def test_wrong_refid():
         value=rec2.id)
     with raises(db.TransactionError):
         rec3.insert()
-    except db.TransactionError:
-        desc = ('Reference not qualified. The value of this Reference '
-                'Property is to be a child of its data type.')
-        err = rec3.get_property("TestP1").get_errors()[0]
-        assert err.description == desc
+    desc = ('Reference not qualified. The value of this Reference '
+            'Property is to be a child of its data type.')
+    err = rec3.get_property("TestP1").get_errors()[0]
+    assert err.description == desc
 
     rec4 = db.Record().add_parent(
         name="TestRT3").add_property(