[#2510] [Tests] Add config test for overwriting None value

This commit is contained in:
Alex Knaust 2014-09-28 10:05:18 +01:00 committed by Calum Lind
parent dd8e37a6ce
commit 3b950094af
1 changed files with 21 additions and 0 deletions

View File

@ -44,6 +44,27 @@ class ConfigTestCase(unittest.TestCase):
config._save_timer.cancel() config._save_timer.cancel()
def test_set_get_item_none(self):
config = Config("test.conf", config_dir=self.config_dir)
config["foo"] = None
self.assertIsNone(config["foo"])
self.assertIsInstance(config["foo"], type(None))
config["foo"] = 1
self.assertEquals(config.get("foo"), 1)
config["foo"] = None
self.assertIsNone(config["foo"])
config["bar"] = None
self.assertIsNone(config["bar"])
config["bar"] = None
self.assertIsNone(config["bar"])
config._save_timer.cancel()
def test_get(self): def test_get(self):
config = Config("test.conf", config_dir=self.config_dir) config = Config("test.conf", config_dir=self.config_dir)
config["foo"] = 1 config["foo"] = 1