code: def test_bool():
      c = ct.EnsureBool()
      # this should always work
      assert_equal(c(True), True)
      assert_equal(c(False), False)
      # all that results in True
      assert_equal(c("True"), True)
      assert_equal(c("true"), True)
      assert_equal(c("1"), True)
      assert_equal(c("yes"), True)
      assert_equal(c("on"), True)
      assert_equal(c("enable"), True)
      # all that results in False
      assert_equal(c("false"), False)
      assert_equal(c("False"), False)
      assert_equal(c("0"), False)
      assert_equal(c("no"), False)
      assert_equal(c("off"), False)
      assert_equal(c("disable"), False)
      # this should always fail
      assert_raises(ValueError, c, 0)
      assert_raises(ValueError, c, 1)
  
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 3 for calling a global function with example usage: test_bool() without return types