当前位置: 首页>>代码示例>>Python>>正文


Python UsagePlugin._get_total_cost_by_warehouses方法代码示例

本文整理汇总了Python中ralph_pricing.plugins.reports.usage.UsagePlugin._get_total_cost_by_warehouses方法的典型用法代码示例。如果您正苦于以下问题:Python UsagePlugin._get_total_cost_by_warehouses方法的具体用法?Python UsagePlugin._get_total_cost_by_warehouses怎么用?Python UsagePlugin._get_total_cost_by_warehouses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ralph_pricing.plugins.reports.usage.UsagePlugin的用法示例。


在下文中一共展示了UsagePlugin._get_total_cost_by_warehouses方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_usage_type_cost_sum_forecast

# 需要导入模块: from ralph_pricing.plugins.reports.usage import UsagePlugin [as 别名]
# 或者: from ralph_pricing.plugins.reports.usage.UsagePlugin import _get_total_cost_by_warehouses [as 别名]
 def test_get_usage_type_cost_sum_forecast(self):
     result = UsagePlugin._get_total_cost_by_warehouses(
         start=datetime.date(2013, 10, 10),
         end=datetime.date(2013, 10, 20),
         usage_type=self.usage_type_cost_sum,
         ventures=[self.venture1],
         forecast=True,
     )
     # 5-12: (usages are from 8 to 12)
     #   usage: 5 * (30 + 60 + 90 + 120) = 1500;
     #   cost: 2000 + 20000 = 22000;
     #   price = 22000 / 1500 = 14.(6);
     # 13-17:
     #   usage: 5 * (30 + 60) = 1500;
     #   cost: 3000 + 30000 = 33000;
     #   price = 33000 / 1500 = 22;
     # 18-25: (usages are from 18 to 22)
     #   usage: 5 * (30 + 60) = 1500;
     #   cost: 5000 + 50000 = 55000;
     #   price = 55000 / 1500 = 36.(6);
     #
     # 10-12: usage: 3 * 30 = 90; cost: 90 * 14.(6) = 1320
     # 13-17: usage: 5 * 30 = 150; cost: 150 * 22 = 3300
     # 18-20: usage: 3 * 30 = 90; cost = 90 * 36.(6) = 3300
     # total: usage: 330; cost: 7920
     self.assertEquals(result, [330.0, D('7920')])
开发者ID:ar4s,项目名称:ralph_pricing,代码行数:28,代码来源:test_usage_base.py

示例2: test_get_usage_type_cost_sum

# 需要导入模块: from ralph_pricing.plugins.reports.usage import UsagePlugin [as 别名]
# 或者: from ralph_pricing.plugins.reports.usage.UsagePlugin import _get_total_cost_by_warehouses [as 别名]
 def test_get_usage_type_cost_sum(self):
     result = UsagePlugin._get_total_cost_by_warehouses(
         start=datetime.date(2013, 10, 10),
         end=datetime.date(2013, 10, 20),
         usage_type=self.usage_type_cost_sum,
         ventures=self.ventures_subset,
         forecast=False,
     )
     # 5-12: (usages are from 8 to 12)
     #   usage: 5 * (30 + 60 + 90 + 120) = 1500;
     #   cost: 1000 + 10000 = 11000;
     #   price = 11000 / 1500 = 7.(3);
     # 13-17:
     #   usage: 5 * (30 + 60) = 1500;
     #   cost: 2000 + 20000 = 11000;
     #   price = 22000 / 1500 = 14.(6);
     # 18-25: (usages are from 18 to 22)
     #   usage: 5 * (30 + 60) = 1500;
     #   cost: 4000 + 40000 = 44000;
     #   price = 11000 / 1500 = 29.(3);
     #
     # 10-12:
     #   usage: 3 * (30 + 60) = 270;
     #   cost: 270 * 7.(3) = 1980
     # 13-17:
     #   usage: 5 * (30 + 60) = 450;
     #   cost: 450 * 14.(6) = 6600
     # 18-20:
     #   usage: 3 * (30 + 60) = 270;
     #   cost: 270 * 29.(3) = 7920
     #
     # total cost: 1980 + 6600 + 7920 = 16500
     self.assertEquals(result, [990.0, D('16500')])
开发者ID:ar4s,项目名称:ralph_pricing,代码行数:35,代码来源:test_usage_base.py

示例3: test_get_usage_type_cost_by_cost_forecast

# 需要导入模块: from ralph_pricing.plugins.reports.usage import UsagePlugin [as 别名]
# 或者: from ralph_pricing.plugins.reports.usage.UsagePlugin import _get_total_cost_by_warehouses [as 别名]
    def test_get_usage_type_cost_by_cost_forecast(self):
        result = UsagePlugin._get_total_cost_by_warehouses(
            start=datetime.date(2013, 10, 10),
            end=datetime.date(2013, 10, 20),
            usage_type=self.usage_type_cost_wh,
            ventures=[self.venture1],
            forecast=True,
        )
        # 5-12: (usages are from 8 to 12)
        #   warehouse1:
        #               usage: 2 * (20 + 40 + 60 + 80) = 400;
        #               cost: 2400;
        #               price = 2400 / 400 = 6;
        #   warehouse2:
        #               usage: 3 * (20 + 40 + 60 + 80) = 600;
        #               cost: 5400;
        #               price = 5400 / 600 = 9;
        # 13-17:
        #   warehouse1:
        #               usage: 3 * (20 + 40 + 60 + 80) = 600;
        #               cost: 5400
        #               price = 5400 / 600 = 9;
        #   warehouse2:
        #               usage: 2 * (20 + 40 + 60 + 80) = 400;
        #               cost: 1200
        #               price = 1200 / 400 = 3;
        # 18-25: (usages are from 18 to 22)
        #   warehouse1:
        #               usage: 2 * (20 + 40 + 60 + 80) = 400;
        #               cost: 12000
        #               price = 12000 / 400 = 30;
        #   warehouse2:
        #               usage: 3 * (20 + 40 + 60 + 80) = 600;
        #               cost: 3600
        #               price = 3600 / 600 = 6;

        # 10-12:
        #   warehouse1: usage: 1 * 20 = 20;
        #               cost: 20 * 6 = 120
        #   warehouse2: usage: 2 * 20 = 40;
        #               cost: 40 * 9 = 360
        # 13-17:
        #   warehouse1: usage: 3 * 20 = 60;
        #               cost: 60 * 9 = 540
        #   warehouse2: usage: 2 * 20 = 40;
        #               cost: 40 * 3 = 120
        # 18-20:
        #   warehouse1: usage: 1 * 20 = 20;
        #               cost: 20 * 30 = 600
        #   warehouse2: usage: 2 * 20 = 40;
        #               cost: 40 * 6 = 240
        # total:
        #   warehouse1: usage: 100; cost: 1260
        #   warehouse2: usage: 120; cost: 720
        #   total: cost: 1980
        self.assertEquals(
            result,
            [100.0, D('1260'), 120.0, D('720'), D('1980')]
        )
开发者ID:ar4s,项目名称:ralph_pricing,代码行数:61,代码来源:test_usage_base.py

示例4: test_get_usage_type_cost_by_cost

# 需要导入模块: from ralph_pricing.plugins.reports.usage import UsagePlugin [as 别名]
# 或者: from ralph_pricing.plugins.reports.usage.UsagePlugin import _get_total_cost_by_warehouses [as 别名]
    def test_get_usage_type_cost_by_cost(self):
        result = UsagePlugin._get_total_cost_by_warehouses(
            start=datetime.date(2013, 10, 10),
            end=datetime.date(2013, 10, 20),
            usage_type=self.usage_type_cost_wh,
            ventures=self.ventures_subset,
            forecast=False,
        )
        # 5-12: (usages are from 8 to 12)
        #   warehouse1:
        #               usage: 2 * (20 + 40 + 60 + 80) = 400;
        #               cost: 3600;
        #               price = 3600 / 400 = 9;
        #   warehouse2:
        #               usage: 3 * (20 + 40 + 60 + 80) = 600;
        #               cost: 3600;
        #               price = 3600 / 600 = 6;
        # 13-17:
        #   warehouse1:
        #               usage: 3 * (20 + 40 + 60 + 80) = 600;
        #               cost: 5400
        #               price = 5400 / 600 = 9;
        #   warehouse2:
        #               usage: 2 * (20 + 40 + 60 + 80) = 400;
        #               cost: 3600
        #               price = 3600 / 400 = 9;
        # 18-25: (usages are from 18 to 22)
        #   warehouse1:
        #               usage: 2 * (20 + 40 + 60 + 80) = 400;
        #               cost: 4800
        #               price = 4800 / 400 = 12;
        #   warehouse2:
        #               usage: 3 * (20 + 40 + 60 + 80) = 600;
        #               cost: 7200
        #               price = 7200 / 600 = 12;

        # 10-12:
        #   warehouse1: usage: 1 * (20 + 40) = 60;
        #               cost: 60 * 9 = 540
        #   warehouse2: usage: 2 * (20 + 40) = 120;
        #               cost: 120 * 6 = 720
        # 13-17:
        #   warehouse1: usage: 3 * (20 + 40) = 180;
        #               cost: 180 * 9 = 1620
        #   warehouse2: usage: 2 * (20 + 40) = 120;
        #               cost: 120 * 9 = 1080
        # 18-20:
        #   warehouse1: usage: 1 * (20 + 40) = 60;
        #               cost: 60 * 12 = 720
        #   warehouse2: usage: 2 * (20 + 40) = 120;
        #               cost: 120 * 12 = 1440
        # total:
        #   warehouse1: usage: 300; cost: 2880
        #   warehouse2: usage: 360; cost: 3240
        #   total: cost: 6840
        self.assertEquals(
            result,
            [300.0, D('2880'), 360.0, D('3240'), D('6120')]
        )
开发者ID:ar4s,项目名称:ralph_pricing,代码行数:61,代码来源:test_usage_base.py

示例5: test_get_usage_type_cost_forecast

# 需要导入模块: from ralph_pricing.plugins.reports.usage import UsagePlugin [as 别名]
# 或者: from ralph_pricing.plugins.reports.usage.UsagePlugin import _get_total_cost_by_warehouses [as 别名]
 def test_get_usage_type_cost_forecast(self):
     result = UsagePlugin._get_total_cost_by_warehouses(
         start=datetime.date(2013, 10, 10),
         end=datetime.date(2013, 10, 20),
         usage_type=self.usage_type,
         ventures=[self.venture1],
         forecast=True,
     )
     # 10-12: usage: 3 * 10 = 30; cost: 30 * 50 = 1500
     # 13-17: usage: 5 * 10 = 50; cost: 50 * 60 = 3000
     # 18-20: usage: 3 * 10 = 30; cost = 30 * 70 = 2100
     # total: usage: 110; cost: 6600
     self.assertEquals(result, [110.0, D('6600')])
开发者ID:ar4s,项目名称:ralph_pricing,代码行数:15,代码来源:test_usage_base.py

示例6: test_get_usage_type_cost

# 需要导入模块: from ralph_pricing.plugins.reports.usage import UsagePlugin [as 别名]
# 或者: from ralph_pricing.plugins.reports.usage.UsagePlugin import _get_total_cost_by_warehouses [as 别名]
 def test_get_usage_type_cost(self):
     result = UsagePlugin._get_total_cost_by_warehouses(
         start=datetime.date(2013, 10, 10),
         end=datetime.date(2013, 10, 20),
         usage_type=self.usage_type,
         ventures=self.ventures_subset,
         forecast=False,
     )
     # 10-12: usage: 3 * (10 + 20) = 90; cost: 90 * 10 = 900
     # 13-17: usage: 5 * (10 + 20) = 150; cost: 150 * 20 = 3000
     # 18-20: usage: 3 * (10 + 20) = 90; cost = 90 * 30 = 2700
     # total: usage: 330; cost: 6600
     self.assertEquals(result, [330.0, D('6600')])
开发者ID:ar4s,项目名称:ralph_pricing,代码行数:15,代码来源:test_usage_base.py


注:本文中的ralph_pricing.plugins.reports.usage.UsagePlugin._get_total_cost_by_warehouses方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。