code: def test_float():
      c = ct.EnsureFloat()
      # this should always work
      assert_equal(c(7.0), 7.0)
      assert_equal(c(7), 7.0)
      assert_equal(c("7"), 7.0)
      assert_equal(c([7.0, "3.0"]), [7.0, 3.0])
      # this should always fail
      assert_raises(ValueError, lambda: c("fail"))
      assert_raises(ValueError, lambda: c([3.0, "fail"]))
  
file_path: datalad/datalad/tests/test_constraints.py
imports: from datalad.tests.utils_pytest import assert_equal, assert_raises
  from ..support import constraints
label_desc: Use image node_id 2 for calling a global function with example usage: test_float() without return types