本文整理汇总了Python中horizons.world.production.productionline.ProductionLine.change_amount方法的典型用法代码示例。如果您正苦于以下问题:Python ProductionLine.change_amount方法的具体用法?Python ProductionLine.change_amount怎么用?Python ProductionLine.change_amount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类horizons.world.production.productionline.ProductionLine
的用法示例。
在下文中一共展示了ProductionLine.change_amount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_change_amount
# 需要导入模块: from horizons.world.production.productionline import ProductionLine [as 别名]
# 或者: from horizons.world.production.productionline.ProductionLine import change_amount [as 别名]
def test_change_amount(self):
self.add_line(1, 10, 0, {2: 3, 4: -5})
line = ProductionLine(1)
line.change_amount(2, 10)
self.assertEqual(line.production, {2: 10, 4: -5})
self.assertEqual(line.produced_res, {2: 10})
self.assertEqual(line.consumed_res, {4: -5})
line.change_amount(4, -1)
self.assertEqual(line.production, {2: 10, 4: -1})
self.assertEqual(line.produced_res, {2: 10})
self.assertEqual(line.consumed_res, {4: -1})
示例2: test_change_amount
# 需要导入模块: from horizons.world.production.productionline import ProductionLine [as 别名]
# 或者: from horizons.world.production.productionline.ProductionLine import change_amount [as 别名]
def test_change_amount(self):
data = {
'time': 10,
'produces': [[2, 3]],
'consumes': [[4, -5]]
}
line = ProductionLine(1, data)
line.change_amount(2, 10)
self.assertEqual(line.production, {2: 10, 4: -5})
self.assertEqual(line.produced_res, {2: 10})
self.assertEqual(line.consumed_res, {4: -5})
line.change_amount(4, -1)
self.assertEqual(line.production, {2: 10, 4: -1})
self.assertEqual(line.produced_res, {2: 10})
self.assertEqual(line.consumed_res, {4: -1})