MCPcopy
hub / github.com/django/django / test_namedtemporaryfile_closes

Method test_namedtemporaryfile_closes

tests/files/tests.py:69–81  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected