def test_file_exists(self): """ It should return path and not create new folder """ self.assertEqual( guarded_join_or_create(ABSPATH, 'README.md'), os.path.join(ABSPATH, 'README.md') )
def test_create_dir(self): """ Dir does not exists - create new """ path = os.path.join(TEST_DIR, "new-dir") # The folder shouldn't exists self.assertFalse(os.path.exists(path)) # The folder should be created guarded_join_or_create(path) # The folder should be created successful self.assertTrue(os.path.exists(path)) # Remove os.rmdir(path) self.assertFalse(os.path.exists(path))