def test_fileClosing(self):
        """
        If writing to the underlying file raises an exception,
        L{FilePath.setContent} raises that exception after closing the file.
        """
        fp = ExplodingFilePath(b"")
        self.assertRaises(IOError, fp.setContent, b"blah")
        self.assertTrue(fp.fp.closed)

        If writing to the underlying file raises an exception,
        L{FilePath.setContent} raises that exception after closing the file.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_paths.py