code: def test_register_custom_issue_manager(monkeypatch):
      import io
      import sys
  
      assert "foo" not in REGISTRY
  
      class Foo(IssueManager):
          issue_name = "foo"
  
          def find_issues(self):
              pass
  
      Foo = register(Foo)
  
      assert REGISTRY["classification"].get("foo") == Foo
  
      # Reregistering should overwrite the existing class, put print a warning
  
      monkeypatch.setattr("sys.stdout", io.StringIO())
  
      class NewFoo(IssueManager):
          issue_name = "foo"
  
          def find_issues(self):
              pass
  
      NewFoo = register(NewFoo)
  
      assert REGISTRY["classification"].get("foo") == NewFoo
      assert all(
          [
              text in sys.stdout.getvalue()
              for text in [
                  "Warning: Overwriting existing issue manager foo with ",
                  "NewFoo",
                  " for task classification.",
              ]
          ]
      ), "Should print a warning"
  
      # Reregistering for task should overwrite the existing class, put print a warning
      class NewerFoo(IssueManager):
          issue_name = "label"
  
          def find_issues(self):
              pass
  
      NewerFoo = register(NewerFoo, task="classification")
  
      assert REGISTRY["classification"].get("label") == NewerFoo
      assert all(
          [
              text in sys.stdout.getvalue()
              for text in [
                  "Warning: Overwriting existing issue manager label with ",
                  "NewerFoo",
                  " for task classification.",
              ]
          ]
      ), "Should print a warning"
  
      # Registering any issue manager for another task is permitted
      class Bar(IssueManager):
          issue_name = "bar"
  
          def find_issues(self):
              pass
  
      Bar = register(Bar, task="regression")
  
      assert REGISTRY["regression"].get("bar") == Bar
  
file_path: cleanlab/tests/datalab/test_issue_manager.py
imports: import numpy
  import pandas
  import pytest
  from cleanlab.datalab.internal.issue_manager import IssueManager
  from cleanlab.datalab.internal.issue_manager_factory import REGISTRY, register
label_desc: Use image node_id 1 for calling a global function with example usage: test_register_custom_issue_manager(monkeypatch) without return types