コード例 #1
0
    def test_other(self):
        """Test with a non-string and non-bool type."""
        with self.assertRaises(ValueError) as exc:
            config._validate_bool({'not a': 'bool'})

        self.assertEqual(str(exc.exception),
                         "\"{'not a': 'bool'}\" is not a bool or a string.")
コード例 #2
0
ファイル: test_config.py プロジェクト: jlebon/bodhi
    def test_string_other(self):
        """Test with an ambiguous string."""
        with self.assertRaises(ValueError) as exc:
            config._validate_bool('oops typo')

        self.assertEqual(str(exc.exception),
                         '"oops typo" cannot be interpreted as a boolean value.')
コード例 #3
0
ファイル: test_config.py プロジェクト: jhonsnow456/bodhi
    def test_string_other(self):
        """Test with an ambiguous string."""
        with pytest.raises(ValueError) as exc:
            config._validate_bool('oops typo')

        assert str(exc.value
                   ) == '"oops typo" cannot be interpreted as a boolean value.'
コード例 #4
0
ファイル: test_config.py プロジェクト: jhonsnow456/bodhi
    def test_other(self):
        """Test with a non-string and non-bool type."""
        with pytest.raises(ValueError) as exc:
            config._validate_bool({'not a': 'bool'})

        assert str(
            exc.value) == "\"{'not a': 'bool'}\" is not a bool or a string."
コード例 #5
0
ファイル: test_config.py プロジェクト: sitedata/bodhi
 def test_string_truthy(self):
     """Test with "truthy" strings."""
     for s in ('t', 'true', 'y', 'yes', 'on', '1'):
         assert config._validate_bool(s)
コード例 #6
0
ファイル: test_config.py プロジェクト: sitedata/bodhi
 def test_string_falsey(self):
     """Test with "falsey" strings."""
     for s in ('f', 'false', 'n', 'no', 'off', '0'):
         assert not config._validate_bool(s)
コード例 #7
0
ファイル: test_config.py プロジェクト: sitedata/bodhi
 def test_bool(self):
     """Test with boolean values."""
     assert not config._validate_bool(False)
     assert config._validate_bool(True)
コード例 #8
0
 def test_bool(self):
     """Test with boolean values."""
     self.assertTrue(config._validate_bool(False) is False)
     self.assertTrue(config._validate_bool(True) is True)