def test_rotateAlreadyExists(self):
        """
        L{DailyLogFile.rotate} doesn't do anything if they new log file already
        exists on the disk.
        """
        log = RiggedDailyLogFile(self.name, self.dir)
        self.addCleanup(log.close)

        # Build a new file with the same name as the file which would be created
        # if the log file is to be rotated.
        newFilePath = "{0}.{1}".format(log.path, log.suffix(log.lastDate))
        with open(newFilePath, "w") as fp:
            fp.write("123")
        previousFile = log._file
        log.rotate()
        self.assertEqual(previousFile, log._file)

        L{DailyLogFile.rotate} doesn't do anything if they new log file already
        exists on the disk.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_logfile.py