The symbol django.core.files.NamedTemporaryFile is assigned as a different class on different operating systems. In any case, the result should minimally mock some of the API of tempfile.NamedTemporaryFile from the Python standard library.
(self)
| 67 | os.unlink(file.name) |
| 68 | |
| 69 | def test_namedtemporaryfile_closes(self): |
| 70 | """ |
| 71 | The symbol django.core.files.NamedTemporaryFile is assigned as |
| 72 | a different class on different operating systems. In |
| 73 | any case, the result should minimally mock some of the API of |
| 74 | tempfile.NamedTemporaryFile from the Python standard library. |
| 75 | """ |
| 76 | tempfile = NamedTemporaryFile() |
| 77 | self.assertTrue(hasattr(tempfile, "closed")) |
| 78 | self.assertFalse(tempfile.closed) |
| 79 | |
| 80 | tempfile.close() |
| 81 | self.assertTrue(tempfile.closed) |
| 82 | |
| 83 | def test_file_mode(self): |
| 84 | # Should not set mode to None if it is not present. |