Example #1
0
    def test_get_for_invalidated_key(self):
        config = MemoryConfig()
        config.set('key', '2')

        version = Version()

        prop = Property('key', 1, int, config, version)

        self.assertEqual(2, prop.get())

        config.set('key', '3')

        version.number += 1

        self.assertEqual(3, prop.get())
Example #2
0
 def test_get_for_nonexistent_key(self):
     prop = Property('key', 1, int, MemoryConfig(), Version())
     self.assertEqual(1, prop.get())
Example #3
0
 def test_get_for_nonexistent_key_with_callable_default_value(self):
     prop = Property('key', lambda: 1, int, MemoryConfig(), Version())
     self.assertEqual(1, prop.get())
Example #4
0
    def test_get_for_existent_key(self):
        config = MemoryConfig()
        config.set('key', '2')

        prop = Property('key', 1, int, config, Version())
        self.assertEqual(2, prop.get())