class_docstr: Tests for composition.
class_docstr_tok: ["Tests","for","composition","."]
docstr: Test composition.
docstr_tok: ["Test","composition","."]
code: def test_compose(self):
      """Test composition."""
  
      def _f(x):
          return x + 2
  
      def _g(x):
          return 2 * x
  
      fog = compose(_f, _g, name="fog")
      for i in range(5):
          with self.subTest(i=i):
              self.assertEqual(_g(_f(i)), fog(i))
              self.assertEqual(_g(_f(i**2)), fog(i**2))
  
imports: import functools
  import itertools
  import operator
  import random
  import string
  import timeit
  import unittest
  from typing import Iterable, Tuple
  import numpy
  import pytest
  import torch
  from pykeen.utils import _weisfeiler_lehman_iteration, _weisfeiler_lehman_iteration_approx, calculate_broadcasted_elementwise_result_shape, clamp_norm, combine_complex, compact_mapping, compose, estimate_cost_of_sequence, flatten_dictionary, get_optimal_sequence, get_until_first_blank, iter_weisfeiler_lehman, logcumsumexp, project_entity, set_random_seed, split_complex, tensor_product, tensor_sum
label_desc: Use image node_id 1 for calling the TestCompose obj's underlying member method code with example usage: obj.test_compose() and returns: unknown, unknown