Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_when_passed_false_it_should_return_false(self):
self.assertFalse(convert_to_bool("false"))
def test_when_passed_no_it_should_return_false(self):
self.assertFalse(convert_to_bool("no"))
def test_when_passed_garbage_it_should_raise_value_error(self):
with self.assertRaises(ValueError):
convert_to_bool("garbage")
def test_when_passed_yes_it_should_return_true(self):
self.assertTrue(convert_to_bool("yes"))
def test_when_passed_None_it_should_raise_value_error(self):
with self.assertRaises(ValueError):
convert_to_bool(None)
def test_when_passed_true_it_should_return_true(self):
self.assertTrue(convert_to_bool("true"))
def test_when_passed_non_zero_it_should_return_true(self):
self.assertTrue(convert_to_bool("1337"))
def test_when_passed_zero_it_should_return_false(self):
self.assertFalse(convert_to_bool("0"))