code: def test_failing_transaction_self_managed(db):
      conn = db.get_connection()
      tx = conn.transaction()
      try:
          conn.query("INSERT INTO foo VALUES (42)")
          conn.query("INSERT INTO foo VALUES (43)")
          raise ValueError()
          tx.commit()
          conn.query("INSERT INTO foo VALUES (44)")
      except ValueError:
          tx.rollback()
      finally:
          conn.close()
          assert db.query("SELECT count(*) AS n FROM foo")[0].n == 0
  
imports: import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: test_failing_transaction_self_managed(db) without return types