예제 #1
0
def test_add():
    with open(CONFIG_FILENAME, "w") as new_file:
        new_file.write("[this]\n\tthat = true\n")
        new_file.write("[something \"other\"]\n\there = false")

    config = Config()
    config.add_file(CONFIG_FILENAME, 0)
    assert 'this.that' in config
    assert config.get_bool('this.that')
    assert 'something.other.here' in config
    assert not config.get_bool('something.other.here')
예제 #2
0
    def test_add(self):
        config = Config()

        new_file = open(CONFIG_FILENAME, "w")
        new_file.write("[this]\n\tthat = true\n")
        new_file.write("[something \"other\"]\n\there = false")
        new_file.close()

        config.add_file(CONFIG_FILENAME, 0)
        self.assertTrue('this.that' in config)
        self.assertTrue(config.get_bool('this.that'))
        self.assertTrue('something.other.here' in config)
        self.assertFalse(config.get_bool('something.other.here'))
예제 #3
0
    def test_add(self):
        config = Config()

        new_file = open(CONFIG_FILENAME, "w")
        new_file.write("[this]\n\tthat = true\n")
        new_file.write("[something \"other\"]\n\there = false")
        new_file.close()

        config.add_file(CONFIG_FILENAME, 0)
        self.assertTrue('this.that' in config)
        self.assertTrue(config.get_bool('this.that'))
        self.assertTrue('something.other.here' in config)
        self.assertFalse(config.get_bool('something.other.here'))
예제 #4
0
    def test_new(self):
        # Touch file
        open(CONFIG_FILENAME, 'w').close()

        config_write = Config(CONFIG_FILENAME)
        self.assertNotEqual(config_write, None)

        config_write['core.bare'] = False
        config_write['core.editor'] = 'ed'

        config_read = Config(CONFIG_FILENAME)
        self.assertTrue('core.bare' in config_read)
        self.assertFalse(config_read.get_bool('core.bare'))
        self.assertTrue('core.editor' in config_read)
        self.assertEqual(config_read['core.editor'], 'ed')
예제 #5
0
    def test_new(self):
        # Touch file
        open(CONFIG_FILENAME, 'w').close()

        config_write = Config(CONFIG_FILENAME)
        assert config_write is not None

        config_write['core.bare'] = False
        config_write['core.editor'] = 'ed'

        config_read = Config(CONFIG_FILENAME)
        assert 'core.bare' in config_read
        assert not config_read.get_bool('core.bare')
        assert 'core.editor' in config_read
        assert config_read['core.editor'] == 'ed'
예제 #6
0
    def test_new(self):
        # Touch file
        open(CONFIG_FILENAME, 'w').close()

        config_write = Config(CONFIG_FILENAME)
        self.assertNotEqual(config_write, None)

        config_write['core.bare'] = False
        config_write['core.editor'] = 'ed'

        config_read = Config(CONFIG_FILENAME)
        self.assertTrue('core.bare' in config_read)
        self.assertFalse(config_read.get_bool('core.bare'))
        self.assertTrue('core.editor' in config_read)
        self.assertEqual(config_read['core.editor'], 'ed')
예제 #7
0
    def test_new(self):
        # Touch file
        open(CONFIG_FILENAME, 'w').close()

        config_write = Config(CONFIG_FILENAME)
        assert config_write is not None

        config_write['core.bare'] = False
        config_write['core.editor'] = 'ed'

        config_read = Config(CONFIG_FILENAME)
        assert 'core.bare' in config_read
        assert not config_read.get_bool('core.bare')
        assert 'core.editor' in config_read
        assert config_read['core.editor'] == 'ed'