code: def test_shape(
      iv_factory: Callable[[tf.Tensor], giv.InducingVariables],
      none_shape: bool,
      expected_shape: Tuple[Optional[int], ...],
  ) -> None:
      M = expected_shape[0]
      ones = tf.ones((7, 3))
      kwargs = {"shape": tf.TensorShape(None)} if none_shape else {}
      iv = iv_factory(tf.Variable(ones, **kwargs))
      if none_shape:
          assert get_shape(iv, TestContext()) is None
      else:
          assert expected_shape == get_shape(iv, TestContext())
      assert M == iv.num_inducing
      assert M == len(iv)
  
file_path: GPflow/tests/gpflow/test_inducing_variables.py
imports: from dataclasses import dataclass
  from typing import Callable, Optional, Tuple
  import numpy
  import pytest
  import tensorflow
  from check_shapes import get_shape
  from check_shapes.error_contexts import ErrorContext, MessageBuilder
  import gpflow
  import gpflow.inducing_variables
label_desc: Use image node_id 2 for calling a global function with example usage: test_shape(iv_factory, none_shape, expected_shape) without return types