code: def test_basic_interface(taskname, task_class):
      print("Evaluating task", taskname)
      task = task_class()
  
      assert task.has_training_docs() in [True, False]
      assert task.has_validation_docs() in [True, False]
      assert task.has_test_docs() in [True, False]
  
      assert isinstance(task.aggregation(), dict)
      assert isinstance(task.higher_is_better(), dict)
      assert task.aggregation().keys() == task.higher_is_better().keys()
  
      for v in task.higher_is_better().values():
          assert v in [True, False]
  
      assert isinstance(task.VERSION, int)
  
      # test deterministic docs
      # (don't test train because it's slow)
  
      task2 = task_class()
  
      limit = None
  
      if taskname in ["triviaqa"] or taskname.startswith("pile_"):
          limit = 10000
      if task.has_validation_docs():
          arr = list(islice(task.validation_docs(), limit))
          arr2 = list(islice(task2.validation_docs(), limit))
  
          assert arr == arr2
  
          reqs = [
              task.construct_requests(doc, task.doc_to_text(doc))
              for doc in arr
          ]
          reqs2 = [
              task2.construct_requests(doc, task2.doc_to_text(doc))
              for doc in arr2
          ]
  
          assert reqs == reqs2
  
      if task.has_test_docs():
          arr = list(islice(task.test_docs(), limit))
          arr2 = list(islice(task2.test_docs(), limit))
  
          assert arr == arr2
  
          reqs = [
              task.construct_requests(doc, task.doc_to_text(doc))
              for doc in arr
          ]
          reqs2 = [
              task2.construct_requests(doc, task2.doc_to_text(doc))
              for doc in arr2
          ]
  
          assert reqs == reqs2
  
      if task.has_training_docs():
          arr = list(islice(task.training_docs(), limit))
          arr2 = list(islice(task2.training_docs(), limit))
  
          assert arr == arr2
  
          reqs = [
              task.construct_requests(doc, task.doc_to_text(doc))
              for doc in arr
          ]
          reqs2 = [
              task2.construct_requests(doc, task2.doc_to_text(doc))
              for doc in arr2
          ]
  
          assert reqs == reqs2
  
imports: import lm_eval.tasks
  import lm_eval.base
  import pytest
  from itertools import islice
label_desc: Use image node_id 1 for calling a global function with example usage: test_basic_interface(taskname, task_class) without return types