def test_add_aspath(): with open(CONFIG_FILENAME, "w") as new_file: new_file.write("[this]\n\tthat = true\n") config = Config() config.add_file(Path(CONFIG_FILENAME), 0) assert 'this.that' in config
def test_multivar(): with open(CONFIG_FILENAME, "w") as new_file: new_file.write("[this]\n\tthat = foobar\n\tthat = foobeer\n") config = Config() config.add_file(CONFIG_FILENAME, 6) assert 'this.that' in config l = list(config.get_multivar('this.that')) assert ['foobar', 'foobeer'] == l l = list(config.get_multivar('this.that', 'bar')) assert ['foobar'] == l l = list(config.get_multivar('this.that', 'foo.*')) assert ['foobar', 'foobeer'] == l config.set_multivar('this.that', '^.*beer', 'fool') l = list(config.get_multivar('this.that', 'fool')) assert ['fool'] == l config.set_multivar('this.that', 'foo.*', 'foo-123456') l = list(config.get_multivar('this.that', 'foo.*')) assert ['foo-123456', 'foo-123456'] == l config.delete_multivar('this.that', 'bar') l = list(config.get_multivar('this.that', '')) assert ['foo-123456', 'foo-123456'] == l config.delete_multivar('this.that', 'foo-[0-9]+') l = list(config.get_multivar('this.that', '')) assert [] == l
def test_add_aspath(self): config = Config() new_file = open(CONFIG_FILENAME, "w") new_file.write("[this]\n\tthat = true\n") new_file.close() config.add_file(Path(CONFIG_FILENAME), 0) assert 'this.that' in config
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')
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'))
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['this.that']) self.assertTrue('something.other.here' in config) self.assertFalse(config['something.other.here'])
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["this.that"]) self.assertTrue("something.other.here" in config) self.assertFalse(config["something.other.here"])
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) 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')