code: def test_tf_cast_precision(
      x: Union[float, tf.Tensor], expect_to_fail: bool
  ) -> None:
      def assert_doesnt_round_to_one() -> None:
          float_64_x = tf.cast(x, dtype=tf.float64)
          assert float_64_x.numpy() != tf.convert_to_tensor(
              1.0, dtype=tf.float64
          )
  
      if expect_to_fail:
          with pytest.raises(AssertionError):
              assert_doesnt_round_to_one()
      else:
          assert_doesnt_round_to_one()
  
file_path: GPflow/tests/gpflow/utilities/test_misc.py
imports: from typing import Any, Union
  import numpy
  import pytest
  import tensorflow
  import tensorflow_probability
  from gpflow.base import Parameter
  from gpflow.utilities import is_variable, to_default_float
label_desc: Use image node_id 3 for calling a global function with example usage: test_tf_cast_precision(x, expect_to_fail) without return types