def test_windows_line_break(self):
     print "\nTest: Convert text files from DOS to Unix formats"
     hutil = MockUtil(self)
     files = [file for file in os.listdir('encoding') if 'dos' in file]
     for file in files:
         file_path = os.path.join('encoding', file)
         cs.preprocess_files(file_path, hutil)
         with open(file_path, 'r') as f:
             contents = f.read()
         self.assertFalse("\r\n" in contents)
Exemplo n.º 2
0
 def test_windows_line_break(self):
     print "\nTest: Convert text files from DOS to Unix formats"
     hutil = MockUtil(self)
     files = [file for file in os.listdir('encoding') if 'dos' in file]
     for file in files:
         file_path = os.path.join('encoding', file)
         cs.preprocess_files(file_path, hutil)
         with open(file_path, 'r') as f:
             contents = f.read()
         self.assertFalse("\r\n" in contents)
 def test_bom(self):
     print "\nTest: Remove BOM"
     hutil = MockUtil(self)
     files = [file for file in os.listdir('encoding') if 'bom' in file]
     for file in files:
         file_path = os.path.join('encoding', file)
         cs.preprocess_files(file_path, hutil)
         with open(file_path, 'r') as f:
             contents = f.read()
         if "utf8" in file:
             self.assertFalse(contents.startswith(codecs.BOM_UTF8))
         if "utf16_le" in file:
             self.assertFalse(contents.startswith(codecs.BOM_LE))
         if "utf16_be" in file:
             self.assertFalse(contents.startswith(codecs.BOM_BE))
Exemplo n.º 4
0
 def test_bom(self):
     print "\nTest: Remove BOM"
     hutil = MockUtil(self)
     files = [file for file in os.listdir('encoding') if 'bom' in file]
     for file in files:
         file_path = os.path.join('encoding', file)
         cs.preprocess_files(file_path, hutil)
         with open(file_path, 'r') as f:
             contents = f.read()
         if "utf8" in file:
             self.assertFalse(contents.startswith(codecs.BOM_UTF8))
         if "utf16_le" in file:
             self.assertFalse(contents.startswith(codecs.BOM_LE))
         if "utf16_be" in file:
             self.assertFalse(contents.startswith(codecs.BOM_BE))