Ticket #14681: revisedtest.diff

File revisedtest.diff, 882 bytes (added by Brett Haydon, 14 years ago)
  • tests/modeltests/files/tests.py

    index 26808f7..1e038c0 100644
     
    11import shutil
    22import sys
     3import gzip
    34
    45from django.core.cache import cache
    56from django.core.files.base import ContentFile
    class FileTests(TestCase):  
    9596        obj4.random.save("random_file", ContentFile("random content"))
    9697        self.assertTrue(obj4.random.name.endswith("/random_file"))
    9798
     99        # Verify fix for #14681, File like objects should not explicitly set
     100        # mode=None for compatibility with stdlib gzip
     101        file = SimpleUploadedFile("gzip_test.txt", "content")
     102        self.assertFalse(hasattr(g, 'mode'))
     103        g = gzip.GzipFile(fileobj=file)
     104       
    98105        # Clean up the temporary files and dir.
    99106        obj1.normal.delete()
    100107        obj2.normal.delete()
Back to Top