def testReplacedOnlyIfBackupFileDoesntExist(self): policyValidator = PolicyValidator() self.assertFalse(policyValidator._backupConfigFileExists(), 'File %s doesn\'t exist, should be False' % os.path.splitext(PolicyValidator.CONFIG_SAV)[1]) open(PolicyValidator.CONFIG_SAV, 'w').close() self.assertTrue(policyValidator._backupConfigFileExists(), 'File %s exists, should be True' % os.path.splitext(PolicyValidator.CONFIG_SAV)[1])