code: def test_range():
      c = ct.EnsureRange(min=3, max=7)
      # this should always work
      assert_equal(c(3.0), 3.0)
  
      # this should always fail
      assert_raises(ValueError, lambda: c(2.9999999))
      assert_raises(ValueError, lambda: c(77))
      assert_raises(TypeError, lambda: c("fail"))
      assert_raises(TypeError, lambda: c((3, 4)))
      # since no type checks are performed
      assert_raises(TypeError, lambda: c("7"))
  
      # Range doesn't have to be numeric
      c = ct.EnsureRange(min="e", max="qqq")
      assert_equal(c("e"), "e")
      assert_equal(c("fa"), "fa")
      assert_equal(c("qq"), "qq")
      assert_raises(ValueError, c, "a")
      assert_raises(ValueError, c, "qqqa")
  
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 10 for calling a global function with example usage: test_range() without return types