def checkItem(provider, id, section, api_response, options):
    if options.debug:
        print "Checking %s result (%s)..." % (provider, id)
    
    # Check aliases are correct
    if section=="aliases":
        aliases = GOLD_RESPONSES[provider]['aliases']
        alias_result = set([namespace for (namespace, nid) in api_response])
        expected_result = set(aliases)
        if (alias_result == expected_result):
            if options.debug:
                print "ALIASES CORRECT! %s" %(alias_result)
        else:
            if options.debug:
                print "ALIASES **NOT** CORRECT, have %s, want %s" %(alias_result, expected_result)
            return False

    # Check biblio are correct
    elif section=="biblio":
        biblio = GOLD_RESPONSES[provider]['biblio']    
        if api_response:
            biblio_result = set(api_response.keys())
        else:
            biblio_result = set([])
        expected_result = set(biblio)

        if (biblio_result == expected_result):
            if options.debug:
                print "BIBLIO CORRECT! %s" %(biblio_result)
        else:
            if options.debug:
                print "BIBLIO **NOT** CORRECT, have %s, want %s" %(biblio_result, expected_result)
            return False

    # Check we've got some metric values
    elif section=="metrics":
        metrics = GOLD_RESPONSES[provider]['metrics']
        for metric in metrics.keys():
            try:
                metric_data = api_response[metric]
            except KeyError:
                # didn't return anything.  problem!
                print "METRICS **NOT** CORRECT for %s: metric missing" % (metric)
                pprint(api_response)
                return False

            # expect the returned value to be equal or larger than reference
            if metric_data >= metrics[metric]:
                if options.debug:
                    print "METRICS CORRECT! %s" %(metric_data)
            else:
                if options.debug:
                    print "METRICS **NOT** CORRECT for %s - %s, expected at least %s" % (metric, metric_data, metrics[metric])
                pprint(api_response)
                return False


    return True
dataset/ETHPy150Open Impactstory/total-impact-core/extras/functional_tests/alt_functional_test.py/checkItem/original