code: def test_listener_with_parameters(
      mocked_client, dataset, query, metrics, condition, query_params
  ):
      try:
          delete(dataset)
      except Exception:
          pass
  
      class TestListener:
          executed = False
          error = None
  
          @listener(
              dataset=dataset,
              query=query,
              metrics=metrics,
              condition=condition,
              execution_interval_in_seconds=1,
              **(query_params or {}),
          )
          def action(
              self, records: List[Record], ctx: RGListenerContext
          ):
              try:
                  assert ctx.dataset == dataset
                  if ctx.query_params:
                      assert ctx.query == query.format(
                          **ctx.query_params
                      )
                      if self.executed:
                          assert ctx.query_params != query_params
                      ctx.query_params["params"] += 1
                  else:
                      assert ctx.query == query
  
                  self.executed = True
  
                  if metrics:
                      for metric in metrics:
                          assert metric in ctx.metrics
              except Exception as error:
                  self.error = error
  
      test = TestListener()
      test.action.start(test)
  
      time.sleep(1.5)
      assert test.action.is_running()
      log(TextClassificationRecord(text="This is a text"), name=dataset)
  
      with pytest.raises(ValueError):
          test.action.start()
  
      time.sleep(1.5)
      assert test.action.is_running()
      test.action.stop()
      assert not test.action.is_running()
  
      with pytest.raises(ValueError):
          test.action.stop()
  
      if condition:
          res = condition(None, None) if metrics else condition(None)
          if not res:
              assert (
                  not test.executed
              ), "Condition is False but action was executed"
  
      else:
          assert test.executed
          if test.error:
              raise test.error
  
file_path: argilla/tests/integration/listeners/test_listener.py
imports: import time
  from typing import List
  import argilla
  import pytest
  from argilla import RGListenerContext, listener
  from argilla.client.api import delete, log
  from argilla.client.models import Record, TextClassificationRecord
label_desc: Use image node_id 2 for calling a global function with example usage: test_listener_with_parameters(mocked_client, dataset, query, metrics, condition, query_params) without return types