Python codecs.BOM_LE Examples

The following are 1 code examples of codecs.BOM_LE(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module codecs , or try the search function .
Example #1
Source File: test_preprocess_file.py    From azure-linux-extensions with Apache License 2.0 5 votes vote down vote up
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))