code: def test_our_multipledispatch() -> None:
      test_fn = get_test_fn()
  
      assert test_fn(A1(), B1()) == "a1-b1"
      assert test_fn(A2(), B1()) == "a2-b1"
      assert test_fn(A1(), B2()) == "a1-b2"
  
      # test the ambiguous case:
  
      with warnings.catch_warnings(record=True) as w:
          warnings.simplefilter("always")
  
          assert (
              test_fn(A2(), B2()) == "a1-b2"
          )  # the last definition wins
  
          assert len(w) == 1
          assert issubclass(
              w[0].category, multipledispatch.conflict.AmbiguityWarning
          )
  
      # test that adding the child-child definition removes ambiguity warning:
  
      @test_fn.register(A2, B2)
      def test_a2_b2(x: A2, y: B2) -> str:
          return "a2-b2"
  
      with warnings.catch_warnings(record=True) as w:
          warnings.simplefilter("always")
  
          assert test_fn(A2(), B2()) == "a2-b2"
  
          assert len(w) == 0
  
file_path: GPflow/tests/gpflow/utilities/test_multipledispatch.py
imports: import re
  import warnings
  from typing import Any, Type
  import multipledispatch
  import pytest
  import tensorflow
  from _pytest.capture import CaptureFixture
  from packaging.version import Version
  import gpflow
  from gpflow.utilities import Dispatcher
label_desc: Use image node_id 2 for calling a global function with example usage: test_our_multipledispatch() and returns: str