From 3b950094af96227377c438b0097fe6c9ee523ed5 Mon Sep 17 00:00:00 2001 From: Alex Knaust Date: Sun, 28 Sep 2014 10:05:18 +0100 Subject: [PATCH] [#2510] [Tests] Add config test for overwriting None value --- deluge/tests/test_config.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/deluge/tests/test_config.py b/deluge/tests/test_config.py index 5fa4d159a..4f5588445 100644 --- a/deluge/tests/test_config.py +++ b/deluge/tests/test_config.py @@ -44,6 +44,27 @@ class ConfigTestCase(unittest.TestCase): 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): config = Config("test.conf", config_dir=self.config_dir) config["foo"] = 1