def _test(self,response):
        #make an ordered list of cases
        ordered_cases = []
        for case in self.cases:
            if len(ordered_cases) == 0:
                ordered_cases.append(self.cases[case])
            else:
                broke = False
                for index in xrange(len(ordered_cases)):
                    if self.cases[case]['mean'] <= ordered_cases[index]['mean']:
                        ordered_cases.insert(index,self.cases[case])
                        broke = True
                        break
                if not broke:
                    ordered_cases.append(self.cases[case])

        value = getattr(response,self.comparison_attr)

        #figure out which case best fits our value
        for index in xrange(len(ordered_cases)):
            lower_avg = None
            upper_avg = None
            math = EasyMath()
            if index != 0:
                lower_avg = math.mean([ordered_cases[index-1]['mean'],ordered_cases[index]['mean']])

            if index != len(ordered_cases) - 1:
                upper_avg = math.mean([ordered_cases[index]['mean'],ordered_cases[index+1]['mean']])

            if not lower_avg and value <= upper_avg:
                return ordered_cases[index]['case']

            elif not upper_avg and value >= lower_avg:
                return ordered_cases[index]['case']

            elif value >= lower_avg and value <= upper_avg:
                return ordered_cases[index]['case']

        #should never get here
        raise Exception('this is shit hitting the fan')
test a value
dataset/ETHPy150Open Neohapsis/bbqsql/bbqsql/lib/requester.py/LooseNumericRequester._test