Beispiel #1
0
 def test_asbool_false(self, mock_bool):
     for val in ("FALse", "NO", "n", "0"):
         self.assertFalse(asbool(val))
         self.assertFalse(mock_bool.called)
Beispiel #2
0
 def test_asbool_true(self, mock_bool):
     for val in ("TRuE", "YES", "y", "1"):
         self.assertTrue(asbool(val))
         self.assertFalse(mock_bool.called)
Beispiel #3
0
 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()
Beispiel #4
0
 def test_asbool_false(self, mock_bool):
     for val in ("FALse", "NO", "n", "0"):
         self.assertFalse(asbool(val))
         self.assertFalse(mock_bool.called)
Beispiel #5
0
 def test_asbool_true(self, mock_bool):
     for val in ("TRuE", "YES", "y", "1"):
         self.assertTrue(asbool(val))
         self.assertFalse(mock_bool.called)
Beispiel #6
0
 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()