def METHOD_NAME(self):
    correct_op_name_and_host_names = [
        ("First main operation", True),
        ("Second main somehost operation", ("somehost",)),
        ("Second main anotherhost operation", ("anotherhost",)),
        ("Function call operation", True),
        ("Third main operation", True),
        ("First nested operation", True),
        ("Second nested anotherhost operation", ("anotherhost",)),
        ("Second nested somehost operation", ("somehost",)),
    ]
    # Run 3 iterations of the test - each time shuffling the order of the
    # hosts - ensuring that the ordering has no effect on the operation order.
    for _ in range(3):
        ctx_state.reset()
        hosts = ["somehost", "anotherhost", "someotherhost"]
        shuffle(hosts)
        result = run_cli(
            ",".join(hosts),
            path.join("tests", "deploy", "deploy_random.py"),
            f'--chdir={path.join("tests", "deploy")}',
        )
        assert result.exit_code == 0, result.stdout
        self._assert_op_data(correct_op_name_and_host_names)
        for hostname, expected_fact_count in (
            ("somehost", 2),
            ("anotherhost", 0),
            ("someotherhost", 1),
        ):
            host = inventory.get_host(hostname)
            assert len(host.facts) == expected_fact_count