def test_update_code_execution_result_new_invocation(empty_state: State):
  """Test updating code execution result for a new invocation."""
  ctx = CodeExecutorContext(empty_state)
  ctx.update_code_execution_result("inv1", "print('hi')", "hi", "")
  results = empty_state["_code_execution_results"]["inv1"]
  assert len(results) == 1
  assert results[0]["code"] == "print('hi')"
  assert results[0]["result_stdout"] == "hi"
  assert results[0]["result_stderr"] == ""
  assert "timestamp" in results[0]
Test updating code execution result for a new invocation.
tests/unittests/code_executors/test_code_executor_context.py