def METHOD_NAME():
    env_generator = os.environ.get("CMAKE_GENERATOR")
    this_platform = platform.system().lower()
    get_best_generator = get_platform().get_best_generator
    arch = platform.architecture()[0]
    if env_generator:
        assert get_best_generator(env_generator).name == env_generator
    if this_platform == "windows":
        # Expected Visual Studio version
        vs_generator = "Visual Studio 15 2017"
        vs_version = 15
        vs_generator += " Win64" if arch == "64bit" else ""
        has_vs_2017 = find_visual_studio(vs_version=VS_YEAR_TO_VERSION["2017"])
        has_vs_2019 = find_visual_studio(vs_version=VS_YEAR_TO_VERSION["2019"])
        has_vs_2022 = find_visual_studio(vs_version=VS_YEAR_TO_VERSION["2022"])
        # As of Dec 2016, this is available only for VS 9.0
        has_vs_for_python_vcvars = any(
            os.path.exists(os.path.expanduser(path_pattern % vs_version))
            for path_pattern in [
                "~/AppData/Local/Programs/Common/Microsoft/Visual C++ for Python/%.1f/vcvarsall.bat",
                "C:/Program Files (x86)/Common Files/Microsoft/Visual C++ for Python/%.1f/vcvarsall.bat",
            ]
        )
        # If environment exists, update the expected generator
        if has_vs_for_python_vcvars and which("ninja.exe"):
            assert get_best_generator().name == "Ninja"
        elif has_vs_2017:
            vs_generator = "Visual Studio 15 2017"
            # Early versions of 2017 may not ship with Ninja (TODO: check)
            assert get_best_generator().name in {"Ninja", vs_generator}
        elif has_vs_2019 or has_vs_2022:
            # ninja is provided by the CMake extension bundled with Visual Studio 2017
            # C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe
            assert get_best_generator().name == "Ninja"
        elif has_vs_for_python_vcvars:
            assert get_best_generator().name == "NMake Makefiles"
    elif this_platform in ["darwin", "linux"]:
        generator = "Ninja" if which("ninja") else "Unix Makefiles"
        assert get_best_generator().name == generator