示例#1
0
 def test_Binary_Op_Multiplication_with_groupby(self):
     measure_ids = self.MeasureName2MeasureIds("SumMult")
     group_by = "ProductType, ks_date, VendorId "
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-06-01", "2014-06-01", group_by)
     value = 0
     code_result = result["SumMult"]
     for key in code_result:
         value = value + int(code_result[key])
     self.assertEqual(60006, value)
示例#2
0
 def test_Binary_Op_Addition_with_groupby_date(self):
     measure_ids = self.MeasureName2MeasureIds("SumPlus")
     group_by = "ks_date"
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-06-01", "2014-06-01", group_by)
     value = 0
     code_result = result["SumPlus"]
     for key in code_result:
         value = value + int(code_result[key])
     self.assertEqual(505, value)
 def test_Binary_Op_Addition_with_groupby(self):
     measure_ids = self.MeasureName2MeasureIds("SumPlus")
     group_by = "ks_date, VendorId, ProductType"
     result = measure_data_V1(self.db, self.company_id, measure_ids, "quarter", "2014-04-01", "2014-06-30", group_by)
     value = 0
     code_result = result["SumPlus"]
     for key in code_result:
         value = value + int(code_result[key])
     self.assertEqual(32, value)
 def test_Binary_Op_Multiplication_with_groupby_date(self):
     measure_ids = self.MeasureName2MeasureIds("SumMult")
     group_by = "ks_date"
     result = measure_data_V1(self.db, self.company_id, measure_ids, "quarter", "2014-04-01", "2014-06-30", group_by)
     value = 0
     code_result = result["SumMult"]
     for key in code_result:
         value = value + int(code_result[key])
     self.assertEqual(247, value)
 def test_Intertable_Addition_with_groupby_date(self):
     measure_ids = self.MeasureName2MeasureIds("NonsenseSum")
     group_by = "ks_date"
     result = measure_data_V1(self.db, self.company_id, measure_ids,"quarter", "2014-04-01", "2014-06-30"  , group_by)
     print result
     value = 0.0
     code_result = result["NonsenseSum"]
     for key in code_result:
         value = value + float(code_result[key])
     self.assertAlmostEqual(13.60960000939, value)
示例#6
0
 def test_Intertable_Multiplication_with_groupby(self):
     measure_ids = self.MeasureName2MeasureIds("Individual_TaxSum")
     group_by = "ks_date, VendorId, ProductType"
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-06-01", "2014-06-01", group_by)
     print result
     value = 0.0
     code_result = result["Individual_TaxSum"]
     for key in code_result:
         value = value + float(code_result[key])
     self.assertAlmostEqual(281.39999520778656, value)
示例#7
0
 def test_Intertable_Addition_with_groupby(self):
     measure_ids = self.MeasureName2MeasureIds("NonsenseSum")
     group_by = "ks_date,ProductType, DownloadDate"
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-06-01", "2014-06-01", group_by)
     print result
     value = 0.0
     code_result = result["NonsenseSum"]
     for key in code_result:
         value = value + float(code_result[key])
     self.assertAlmostEqual(204.8, value)
 def test_Intertable_Multiplication_with_groupby_date(self):
     measure_ids = self.MeasureName2MeasureIds("Individual_TaxSum")
     group_by = "ks_date"
     result = measure_data_V1(self.db, self.company_id, measure_ids, "quarter", "2014-04-01", "2014-06-30", group_by)
     print result
     value = 0.0
     code_result = result["Individual_TaxSum"]
     for key in code_result:
         value = value + float(code_result[key])
     self.assertAlmostEqual(4.95360006, value)
 def test_Binary_Op_Multiplication_with_groupby_date(self):
     measure_ids = self.MeasureName2MeasureIds("SumMult")
     group_by = "ks_date"
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-06-01", "2014-06-01", group_by,None,
                           "and VendorId='0268_20140114_SOFA_ENGLIS'")
     value = 0
     code_result = result["SumMult"]
     for key in code_result:
         value = value + int(code_result[key])
     self.assertEqual(24, value)
 def test_Intertable_Addition_with_groupby_date(self):
     measure_ids = self.MeasureName2MeasureIds("NonsenseSum")
     group_by = "ks_date"
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-06-01", "2014-06-01", group_by,None,
                           "and VendorId='0268_20140114_SOFA_ENGLIS'")
     print result
     value = 0.0
     code_result = result["NonsenseSum"]
     for key in code_result:
         value = value + float(code_result[key])
     self.assertAlmostEqual(4.104800001, value)
 def test_Intertable_Multiplication_with_groupby(self):
     measure_ids = self.MeasureName2MeasureIds("Individual_TaxSum")
     group_by = "ks_date, VendorId, ProductType"
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-06-01", "2014-06-01", group_by,None,
                           "and VendorId='0268_20140114_SOFA_ENGLIS'")
     print result
     value = 0.0
     code_result = result["Individual_TaxSum"]
     for key in code_result:
         value = value + float(code_result[key])
     self.assertAlmostEqual(0.419200005, value)
示例#12
0
 def test_Intertable_Addition_without_groupby_per_record(self):
     measure_ids = self.MeasureName2MeasureIds("Nonsense")
     result = measure_data_V1(self.db, self.company_id, measure_ids, "quarter", "2014-04-01", "2014-06-30")
     self.assertAlmostEqual(13.60960000939, result["Nonsense"]["total"])
示例#13
0
 def test_Intertable_Multiplication_without_groupby_per_record(self):
     #self.assertAlmostEqual(0.6192, self.ks_analytics.calculate("RoyaltyPrice*TaxRate","6/1/14"))
     measure_ids = self.MeasureName2MeasureIds("Individual_Tax")
     result = measure_data_V1(self.db, self.company_id, measure_ids, "quarter", "2014-04-01", "2014-06-30")
     self.assertAlmostEqual(1.3192000202834, result["Individual_Tax"]["total"])
 def test_Intertable_Addition_without_groupby_per_record(self):
     measure_ids = self.MeasureName2MeasureIds("Nonsense")
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-06-01", "2014-06-01",None,None,
                           "and VendorId='0268_20140114_SOFA_ENGLIS'")
     self.assertAlmostEqual(4.104800001, result["Nonsense"]["total"])
示例#15
0
 def test_Binary_Op_Addition_without_groupby_per_record(self):
     measure_ids = self.MeasureName2MeasureIds("Plus")
     result = measure_data_V1(self.db, self.company_id, measure_ids, "quarter", "2014-04-01", "2014-06-30")
     self.assertEqual(32, result["Plus"]["total"])
示例#16
0
 def test_Binary_Op_Multiplication_without_groupby_per_record(self):
     measure_ids = self.MeasureName2MeasureIds("NET_REVENUE")
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-04-01", "2014-06-30")
     print result
     self.assertEqual(42, result["NET_REVENUE"]["total"])
示例#17
0
 def test_Chained_Intertable(self):
     measure_ids = self.MeasureName2MeasureIds("REVENUE_AFTER_TAX")
     result = measure_data_V1(self.db, self.company_id, measure_ids, "quarter", "2014-04-01", "2014-06-30")
     self.assertAlmostEqual(37.7424006462097, result["REVENUE_AFTER_TAX"]["total"])
 def test_Chained_Intertable(self):
     measure_ids = self.MeasureName2MeasureIds("REVENUE_AFTER_TAX")
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-06-01", "2014-06-01",None,None,
                           "and VendorId='0268_20140114_SOFA_ENGLIS'")
     self.assertAlmostEqual(11.37120008468, result["REVENUE_AFTER_TAX"]["total"])
 def test_Binary_Op_Multiplication_without_groupby_per_record(self):
     measure_ids = self.MeasureName2MeasureIds("NET_REVENUE")
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-06-01", "2014-06-01",None,None,
                           "and VendorId='0268_20140114_SOFA_ENGLIS'")
     self.assertEqual(12, result["NET_REVENUE"]["total"])
 def test_Binary_Op_Aggregate(self):
     measure_ids = self.MeasureName2MeasureIds("Units")
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-06-01", "2014-06-01",None,None,
                           "and VendorId='0268_20140114_SOFA_ENGLIS'")
     self.assertEqual(6, result["Units"]["total"])
示例#21
0
 def test_Binary_Op_Aggregate(self):
     measure_ids = self.MeasureName2MeasureIds("Units")
     result = measure_data_V1(self.db, self.company_id, measure_ids, "quarter", "2014-4-1", "2014-6-30")
     self.assertEqual(19, result["Units"]["total"])
示例#22
0
 def test_Chained_Intertable(self):
     measure_ids = self.MeasureName2MeasureIds("REVENUE_AFTER_TAX")
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-06-01", "2014-06-01")
     self.assertAlmostEqual(18001.800000190735, result["REVENUE_AFTER_TAX"]["total"])
示例#23
0
 def test_Binary_Op_Aggregate(self):
     measure_ids = self.MeasureName2MeasureIds("Units")
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-06-01", "2014-06-01")
     self.assertEqual(303, result["Units"]["total"])
 def test_Intertable_Multiplication_without_groupby_per_record(self):
     #self.assertAlmostEqual(0.6192, self.ks_analytics.calculate("RoyaltyPrice*TaxRate","6/1/14"))
     measure_ids = self.MeasureName2MeasureIds("Individual_Tax")
     result = measure_data_V1(self.db, self.company_id, measure_ids, "day", "2014-06-01", "2014-06-01",None,None,
                           "and VendorId='0268_20140114_SOFA_ENGLIS'")
     self.assertAlmostEqual(0.209600002, result["Individual_Tax"]["total"])