def test_asbool_false(self, mock_bool): for val in ("FALse", "NO", "n", "0"): self.assertFalse(asbool(val)) self.assertFalse(mock_bool.called)
def test_asbool_true(self, mock_bool): for val in ("TRuE", "YES", "y", "1"): self.assertTrue(asbool(val)) self.assertFalse(mock_bool.called)
def test_asbool_not_string(self, mock_bool): mock_bool.return_value = sentinel.val for val in ({}, (), 0, None): self.assertEqual(asbool(val), sentinel.val) mock_bool.assert_called_once_with(val) mock_bool.reset_mock()