diff options
Diffstat (limited to 'tests/test_git_config.py')
| -rw-r--r-- | tests/test_git_config.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_git_config.py b/tests/test_git_config.py index 6aa6b381..4541b35c 100644 --- a/tests/test_git_config.py +++ b/tests/test_git_config.py | |||
| @@ -71,6 +71,43 @@ class GitConfigUnitTest(unittest.TestCase): | |||
| 71 | val = config.GetString('empty') | 71 | val = config.GetString('empty') |
| 72 | self.assertEqual(val, None) | 72 | self.assertEqual(val, None) |
| 73 | 73 | ||
| 74 | def test_GetBoolean_undefined(self): | ||
| 75 | """Test GetBoolean on key that doesn't exist.""" | ||
| 76 | self.assertIsNone(self.config.GetBoolean('section.missing')) | ||
| 77 | |||
| 78 | def test_GetBoolean_invalid(self): | ||
| 79 | """Test GetBoolean on invalid boolean value.""" | ||
| 80 | self.assertIsNone(self.config.GetBoolean('section.boolinvalid')) | ||
| 81 | |||
| 82 | def test_GetBoolean_true(self): | ||
| 83 | """Test GetBoolean on valid true boolean.""" | ||
| 84 | self.assertTrue(self.config.GetBoolean('section.booltrue')) | ||
| 85 | |||
| 86 | def test_GetBoolean_false(self): | ||
| 87 | """Test GetBoolean on valid false boolean.""" | ||
| 88 | self.assertFalse(self.config.GetBoolean('section.boolfalse')) | ||
| 89 | |||
| 90 | def test_GetInt_undefined(self): | ||
| 91 | """Test GetInt on key that doesn't exist.""" | ||
| 92 | self.assertIsNone(self.config.GetInt('section.missing')) | ||
| 93 | |||
| 94 | def test_GetInt_invalid(self): | ||
| 95 | """Test GetInt on invalid integer value.""" | ||
| 96 | self.assertIsNone(self.config.GetBoolean('section.intinvalid')) | ||
| 97 | |||
| 98 | def test_GetInt_valid(self): | ||
| 99 | """Test GetInt on valid integers.""" | ||
| 100 | TESTS = ( | ||
| 101 | ('inthex', 16), | ||
| 102 | ('inthexk', 16384), | ||
| 103 | ('int', 10), | ||
| 104 | ('intk', 10240), | ||
| 105 | ('intm', 10485760), | ||
| 106 | ('intg', 10737418240), | ||
| 107 | ) | ||
| 108 | for key, value in TESTS: | ||
| 109 | self.assertEqual(value, self.config.GetInt('section.%s' % (key,))) | ||
| 110 | |||
| 74 | 111 | ||
| 75 | if __name__ == '__main__': | 112 | if __name__ == '__main__': |
| 76 | unittest.main() | 113 | unittest.main() |
