我在角度9的单元测试中遇到问题,我不知道如何测试此功能,我无法对其进行测试。
import os
import sys
class SimplePool:
"""
a simple pool that runs up to <n> processes in parallel,
but it doesn't communicate with them
"""
def __init__(self, size):
self.size = size
def starmap(self, func, it):
n_running = 0
for values in it:
while n_running == self.size:
os.wait()
n_running -= 1
if os.fork() == 0:
func(*values)
sys.exit(0)
n_running += 1
while n_running > 0:
os.wait()
n_running -= 1
请帮助我!