Example #1
0
 def test_truthy(self):
     """
     Fails if truthy values are incorrectly converted.
     """
     assert to_bool("t")
     assert to_bool("yes")
     assert to_bool("on")
Example #2
0
 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")
Example #3
0
 def test_unhashable(self):
     """
     Fails if value is unhashable.
     """
     with pytest.raises(ValueError, match="Cannot convert value to bool"):
         to_bool([])