We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a85ab29 commit a7b86a1Copy full SHA for a7b86a1
tests/test_converters.py
@@ -134,3 +134,28 @@ class C(object):
134
135
c = C()
136
assert True is c.a1 is c.a2
137
+
138
139
+class TestToBool(object):
140
+ def test_unhashable(self):
141
+ """
142
+ Fails if value is unhashable.
143
144
+ with pytest.raises(ValueError, match="Cannot convert value to bool"):
145
+ to_bool([])
146
147
+ def test_truthy(self):
148
149
+ Fails if truthy values are incorrectly converted.
150
151
+ assert to_bool("t")
152
+ assert to_bool("yes")
153
+ assert to_bool("on")
154
155
+ def test_falsy(self):
156
157
+ Fails if falsy values are incorrectly converted.
158
159
+ assert not to_bool("f")
160
+ assert not to_bool("no")
161
+ assert not to_bool("off")
0 commit comments