def METHOD_NAME(pyi_builder, tmpdir, datas=None, binaries=None):
    extra_args = []
    for src_name, dest_name in datas or []:
        extra_args += ['--add-data', f"{src_name}{os.pathsep}{dest_name}"]
    for src_name, dest_name in binaries or []:
        extra_args += ['--add-binary', f"{src_name}{os.pathsep}{dest_name}"]
    pyi_builder.test_source("""
        print("Hello world!")
        """, pyi_args=extra_args)
    # Return path to the generated Analysis-XX.toc in the build directory
    analysis_toc_file = list((pathlib.Path(tmpdir) / "build/test_source").glob("Analysis-??.toc"))
    assert len(analysis_toc_file) == 1
    analysis_toc_file = analysis_toc_file[0]
    # Load the serialized Analysis state, and take out the `binaries` and `datas` TOC lists.
    # The indices correspond to the lists' location in the `Analysis._guts`.
    analysis_data = miscutils.load_py_data_struct(analysis_toc_file)
    return (
        analysis_data[14],  # binaries
        analysis_data[17],  # datas
    )