

def testNonTerminatingBinaryPercent(self):
    dist = {
        1: 20.0,
        10: 80.0,
    }
    iter = object_storage_api_tests.SizeDistributionIterator(dist)
    with mock.patch((random.__name__ + '.random')) as rand:
        rand.side_effect = [0.1, 0.9]
        values = list(itertools.islice(iter, 2))
        self.assertTrue((values == [1, 10]))

dataset/ETHPy150Open GoogleCloudPlatform/PerfKitBenchmarker/script-tests/object_storage_worker_tests.py TestSizeDistributionIterator.testNonTerminatingBinaryPercent/original