示例#1
0
    def test_async_apply_with_iter(self, adapter_pool: AdapterPool):
        TestSimplePool._initial()
        adapter_pool.initial()
        adapter_pool.async_apply_with_iter(functions_iter=target_funcs_iter())
        TestSimplePool._chk_record()

        _results = adapter_pool.get_result()
        TestSimplePool.chk_results(results=_results, expected_size=Task_Size)
示例#2
0
    def test_apply(self, adapter_pool: AdapterPool):
        TestSimplePool._initial()
        adapter_pool.initial()
        adapter_pool.apply(tasks_size=Task_Size, function=target_function)
        TestSimplePool._chk_blocking_record()

        _results = adapter_pool.get_result()
        TestSimplePool.chk_results(results=_results, expected_size=Task_Size)
示例#3
0
    def test_imap_unordered(self, adapter_pool: AdapterPool):
        TestSimplePool._initial()
        adapter_pool.initial()
        adapter_pool.imap_unordered(function=target_function_for_map,
                                    args_iter=Test_Function_Args)
        TestSimplePool._chk_map_record()

        _results = adapter_pool.get_result()
        TestSimplePool.chk_results(results=_results,
                                   expected_size=len(Test_Function_Args))
示例#4
0
    def test_async_map_by_args(self, adapter_pool: AdapterPool):
        TestSimplePool._initial()
        adapter_pool.initial()
        adapter_pool.async_map_by_args(function=target_function_for_map,
                                       args_iter=Test_Function_Multiple_Args)
        TestSimplePool._chk_map_record()

        _results = adapter_pool.get_result()
        TestSimplePool.chk_results(
            results=_results, expected_size=len(Test_Function_Multiple_Args))
示例#5
0
 def test_close(self, adapter_pool: AdapterPool):
     try:
         adapter_pool.initial()
         adapter_pool.async_apply(tasks_size=Task_Size,
                                  function=lambda a: a + a,
                                  args=(1, ))
         adapter_pool.close()
     except Exception:
         assert False, f"It should work finely without any issue. Please check it.\n Error: {traceback.format_exc()}"
     else:
         assert True, "It work finely without any issue."