def test_truthy(self): """ Fails if truthy values are incorrectly converted. """ assert to_bool("t") assert to_bool("yes") assert to_bool("on")
def test_falsy(self): """ Fails if falsy values are incorrectly converted. """ assert not to_bool("f") assert not to_bool("no") assert not to_bool("off")
def test_unhashable(self): """ Fails if value is unhashable. """ with pytest.raises(ValueError, match="Cannot convert value to bool"): to_bool([])