'Test to validate that result metadata is appropriately populated across protocol version
In protocol version 1 result metadata is retrieved everytime the statement is issued. In all
other protocol versions it\'s set once upon the prepare, then re-used. This test ensures that it manifests
it\'s self the same across multiple protocol versions.
@since 3.6.0
@jira_ticket PYTHON-71
@expected_result result metadata is consistent.'

def test_prepared_metadata_generation(self):

    base_line = None
    for proto_version in get_supported_protocol_versions():
        beta_flag = (True if (proto_version in ProtocolVersion.BETA_VERSIONS) else False)
        cluster = Cluster(protocol_version=proto_version, allow_beta_protocol_version=beta_flag)
        session = cluster.connect()
        select_statement = session.prepare('SELECT    *    FROM    system.local')
        if (proto_version == 1):
            self.assertEqual(select_statement.result_metadata, None)
        else:
            self.assertNotEqual(select_statement.result_metadata, None)
        future = session.execute_async(select_statement)
        results = future.result()
        if (base_line is None):
            base_line = results[0]._asdict().keys()
        else:
            self.assertEqual(base_line, results[0]._asdict().keys())
        cluster.shutdown()
