def test_dump(self): props = OrderedDict() props["a"] = 1 props["b"] = "2\n" props["c"] = " 3 : =" out = StringIO() Properties.dump(props, out) self.assertEqual("a=1\nb=2\\\n\nc=\\ 3\\ \\:\\ \\=\n", out.getvalue())
def test_dump(self): props = OrderedDict() props['a'] = 1 props['b'] = '''2 ''' props['c'] =' 3 : =' out = StringIO() Properties.dump(props, out) self.assertEqual('a=1\nb=2\\\n\nc=\\ 3\\ \\:\\ \\=\n', out.getvalue())
def assertLoaded(self, contents, expected): self.assertEqual(expected, Properties.load(contents))
def load(path): """Loads a pushdb maintained in a properties file at the given path.""" with open(path, 'r') as props: properties = Properties.load(props) return PushDb(properties)
def dump(self, path): """Saves the pushdb as a properties file to the given path.""" with open(path, 'w') as props: Properties.dump(self._props, props)