Beispiel #1
0
 def test_get_encoded_zip_files(self):
     # See igor.py, do_zipmods, for the text of these files.
     zip_file = "tests/zipmods.zip"
     sys.path.append(zip_file)       # So we can import the files.
     for encoding in ["utf8", "gb2312", "hebrew", "shift_jis", "cp1252"]:
         filename = zip_file + "/encoded_" + encoding + ".py"
         filename = filename.replace("/", os.sep)
         zip_data = get_zip_bytes(filename)
         zip_text = zip_data.decode(encoding)
         self.assertIn('All OK', zip_text)
         # Run the code to see that we really got it encoded properly.
         __import__("encoded_"+encoding)
Beispiel #2
0
 def test_get_encoded_zip_files(self):
     # See igor.py, do_zipmods, for the text of these files.
     zip_file = "tests/zipmods.zip"
     sys.path.append(zip_file)  # So we can import the files.
     for encoding in ["utf8", "gb2312", "hebrew", "shift_jis", "cp1252"]:
         filename = zip_file + "/encoded_" + encoding + ".py"
         filename = filename.replace("/", os.sep)
         zip_data = get_zip_bytes(filename)
         zip_text = zip_data.decode(encoding)
         self.assertIn('All OK', zip_text)
         # Run the code to see that we really got it encoded properly.
         __import__("encoded_" + encoding)
Beispiel #3
0
 def test_get_encoded_zip_files(self, encoding):
     # See igor.py, do_zipmods, for the text of these files.
     zip_file = "tests/zipmods.zip"
     sys.path.append(zip_file)       # So we can import the files.
     filename = zip_file + "/encoded_" + encoding + ".py"
     filename = os_sep(filename)
     zip_data = get_zip_bytes(filename)
     zip_text = zip_data.decode(encoding)
     assert 'All OK' in zip_text
     # Run the code to see that we really got it encoded properly.
     mod = __import__("encoded_"+encoding)
     assert mod.encoding == encoding