コード例 #1
0
 def test_vdf_parsing(self, file):
     """Tests that parsing and regenerating a vdf file generates the same contents"""
     path = os.path.join(vdfs_folder, file)
     file_contents = open(path, "r").read()
     shortcuts = ShortcutParser().parse(path)
     generated_contents = ShortcutGenerator().to_string(shortcuts)
     self.assertEqual(file_contents.lower(), generated_contents.lower())
コード例 #2
0
 def test_vdf_parsing(self, file):
   """Tests that parsing and regenerating a vdf file generates the same contents"""
   path = os.path.join(vdfs_folder, file)
   file_contents = open(path,"r").read()
   shortcuts = ShortcutParser().parse(path)
   generated_contents = ShortcutGenerator().to_string(shortcuts)
   self.assertEqual(file_contents.lower(),generated_contents.lower())
コード例 #3
0
ファイル: user.py プロジェクト: 2m/pysteam
 def save_shortcuts(self, path=None, makedirs=True):
     if path is None:
         path = self.shortcuts_file()
     parent_directory = os.path.dirname(path)
     if not os.path.isdir(parent_directory) and makedirs:
         try:
             os.makedirs(parent_directory)
         except OSError:
             raise OSError("Cannot write to directory `%s`." %
                           parent_directory)
     # Write shortcuts to file
     try:
         contents = ShortcutGenerator().to_string(self.shortcuts)
         with open(path, "w") as f:
             f.write(contents)
     except IOError:
         raise IOError("Cannot save file to `%s`. Permission Denied")
コード例 #4
0
ファイル: test_vdf_parsing.py プロジェクト: Dennovin/pysteam
 def test_file_equality(self):
     file_contents = open(path,"r").read()
     shortcuts = ShortcutParser().parse(path)
     generated_contents = ShortcutGenerator().to_string(shortcuts)
     self.assertEqual(file_contents.lower(),generated_contents.lower())