コード例 #1
0
    def setUp(self):
        TestCalculator.setUp(self)
        self.calculations = [
            # constants
            '-9 + 5',

            # aliases
            'rating',
            'gps',

            # arithmetic
            'amount + gps_alt',
            'amount - gps_alt',
            'amount + 5',
            'amount - gps_alt + 2.5',
            'amount * gps_alt',
            'amount / gps_alt',
            'amount * gps_alt / 2.5',
            'amount + gps_alt * gps_precision',

            # precedence
            '(amount + gps_alt) * gps_precision',

            # comparison
            'amount == 2',
            '10 < amount',
            '10 < amount + gps_alt',

            # logical
            'not amount == 2',
            'not(amount == 2)',
            'amount == 2 and 10 < amount',
            'amount == 2 or 10 < amount',
            'not not amount == 2 or 10 < amount',
            'not amount == 2 or 10 < amount',
            '(not amount == 2) or 10 < amount',
            'not(amount == 2 or 10 < amount)',
            'amount ^ 3',
            '(amount + gps_alt) ^ 2 + 100',
            '-amount',
            '-amount < gps_alt - 100',

            # membership
            'rating in ["delectible"]',
            'risk_factor in ["low_risk"]',
            'amount in ["9.0", "2.0", "20.0"]',
            '(risk_factor in ["low_risk"]) and (amount in ["9.0", "20.0"])',

            # dates
            'date("09-04-2012") - submit_date > 21078000',

            # cases
            'case food_type in ["morning_food"]: 1, food_type in ["lunch"]: 2,'
            ' default: 3',
            'case food_type in ["morning_food"]: 1, food_type in ["lunch"]: 2',

            # row-wise column-based aggregations
            'percentile(amount)',
        ]
コード例 #2
0
 def setUp(self):
     TestCalculator.setUp(self)
     self.calculations = [
         'max(amount)',
         'mean(amount)',
         'median(amount)',
         'min(amount)',
         'sum(amount)',
         'sum(gps_latitude)',
         'ratio(amount, gps_latitude)',
         'sum(risk_factor in ["low_risk"])',
         'ratio(risk_factor in ["low_risk"], risk_factor in ["low_risk",'
         ' "medium_risk"])',
         'ratio(risk_factor in ["low_risk"], 1)',
         'count(risk_factor in ["low_risk"])',
         'count()',
         'argmax(submit_date)',
         'newest(submit_date, amount)',
     ]
     self.expected_length = defaultdict(int)
     self.groups_list = None
コード例 #3
0
ファイル: test_aggregations.py プロジェクト: j/bamboo
 def setUp(self):
     TestCalculator.setUp(self)
     self.calculations = [
         "pearson(gps_latitude, amount)",
         "var(amount)",
         "std(amount)",
         "max(amount)",
         "mean(amount)",
         "median(amount)",
         "min(amount)",
         "sum(amount)",
         "sum(gps_latitude)",
         "ratio(amount, gps_latitude)",
         'sum(risk_factor in ["low_risk"])',
         'ratio(risk_factor in ["low_risk"], risk_factor in ["low_risk",' ' "medium_risk"])',
         'ratio(risk_factor in ["low_risk"], 1)',
         'count(risk_factor in ["low_risk"])',
         "count()",
         "argmax(submit_date)",
         "newest(submit_date, amount)",
     ]
     self.expected_length = defaultdict(int)
     self.groups_list = None
コード例 #4
0
 def setUp(self):
     TestCalculator.setUp(self)
     self.calculations = AGG_CALCS_TO_DEPS.keys()
     self.expected_length = defaultdict(int)
     self.groups_list = None
コード例 #5
0
 def setUp(self):
     TestCalculator.setUp(self)
     self.calculations = CALCS_TO_DEPS.keys()
     self.dynamic_calculations = DYNAMIC
コード例 #6
0
ファイル: test_aggregations.py プロジェクト: 4sp1r3/bamboo
 def setUp(self):
     TestCalculator.setUp(self)
     self.calculations = AGG_CALCS_TO_DEPS.keys()
     self.expected_length = defaultdict(int)
     self.groups_list = None
コード例 #7
0
ファイル: test_calculations.py プロジェクト: sparkplug/bamboo
 def setUp(self):
     TestCalculator.setUp(self)
     self.calculations = CALCS_TO_DEPS.keys()