code: def test_exp_optional():
      from pybind11_tests import (
          double_or_zero_exp,
          half_or_none_exp,
          test_nullopt_exp,
      )
  
      assert double_or_zero_exp(None) == 0
      assert double_or_zero_exp(42) == 84
      pytest.raises(TypeError, double_or_zero_exp, "foo")
  
      assert half_or_none_exp(0) is None
      assert half_or_none_exp(42) == 21
      pytest.raises(TypeError, half_or_none_exp, "foo")
  
      assert test_nullopt_exp() == 42
      assert test_nullopt_exp(None) == 42
      assert test_nullopt_exp(42) == 42
      assert test_nullopt_exp(43) == 43
  
file_path: coremltools/deps/pybind11/tests/test_python_types.py
imports: import pytest
  from pybind11_tests import ExamplePythonTypes, ConstructorStats, has_optional, has_exp_optional
label_desc: Use image node_id 12 for calling a global function with example usage: test_exp_optional() without return types