def test_HEADClosesFile(self):
        """
        A HEAD request opens the file, gets the size, and then closes it after
        the request.
        """
        fakeFile, file = self._makeFilePathWithStringIO()
        request = DummyRequest([''])
        request.method = b'HEAD'
        self.successResultOf(_render(file, request))
        self.assertEqual(b''.join(request.written), b'')
        self.assertTrue(fakeFile.closed)

        A HEAD request opens the file, gets the size, and then closes it after
        the request.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_static.py