コード例 #1
0
 def test_set_hash_gets_quoted(self):
     c = ConfigFile()
     c.set(b"xandikos", b"color", b"#665544")
     f = BytesIO()
     c.write_to_file(f)
     self.assertEqual(b"[xandikos]\n\tcolor = \"#665544\"\n", f.getvalue())
コード例 #2
0
 def test_write_to_file_section(self):
     c = ConfigFile()
     c.set((b"core", ), b"foo", b"bar")
     f = BytesIO()
     c.write_to_file(f)
     self.assertEqual(b"[core]\n\tfoo = bar\n", f.getvalue())
コード例 #3
0
 def test_write_to_file_subsection(self):
     c = ConfigFile()
     c.set((b"branch", b"blie"), b"foo", b"bar")
     f = BytesIO()
     c.write_to_file(f)
     self.assertEqual(b"[branch \"blie\"]\n\tfoo = bar\n", f.getvalue())
コード例 #4
0
 def test_write_to_file_empty(self):
     c = ConfigFile()
     f = BytesIO()
     c.write_to_file(f)
     self.assertEqual(b"", f.getvalue())