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


Python DeliveryNodeFactory.quantity_in方法代码示例

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


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

示例1: test_should_compute_quantity_in_from_incoming_arcs

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import quantity_in [as 别名]
    def test_should_compute_quantity_in_from_incoming_arcs(self):
        node = DeliveryNodeFactory(quantity=0)
        ArcFactory(source=None, target=node, quantity=50)
        self.assertEqual(node.quantity_in(), 50)

        ArcFactory(source=None, target=node, quantity=50)
        self.assertEqual(node.quantity_in(), 100)

        Arc.objects.all().delete()
        self.assertEqual(node.quantity_in(), 0)
开发者ID:v55448330,项目名称:eums,代码行数:12,代码来源:test_delivery_node.py

示例2: test_should_ignore_quantity_on_update_if_parents_are_specified

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import quantity_in [as 别名]
    def test_should_ignore_quantity_on_update_if_parents_are_specified(self):
        node_one = DeliveryNodeFactory()

        node = DeliveryNodeFactory(quantity=0)

        node.parents = [{'id': node_one.id, 'quantity': 7}]
        node.quantity = 50
        node.save()
        self.assertEqual(node.quantity_in(), 7)

        node.parents = []
        node.save()
        self.assertEqual(node.quantity_in(), 0)
开发者ID:v55448330,项目名称:eums,代码行数:15,代码来源:test_delivery_node.py

示例3: test_update_should_override_parents_when_parents_list_is_passed

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import quantity_in [as 别名]
    def test_update_should_override_parents_when_parents_list_is_passed(self):
        node_one = DeliveryNodeFactory()
        node_two = DeliveryNodeFactory()

        node = DeliveryNodeFactory(parents=[{'id': node_one.id, 'quantity': 8}, {'id': node_two.id, 'quantity': 10}])
        self.assertEqual(node.quantity_in(), 18)

        node.parents = [{'id': node_one.id, 'quantity': 7}]
        node.save()
        self.assertEqual(node.quantity_in(), 7)

        node.parents = []
        node.save()
        self.assertEqual(node.quantity_in(), 0)
开发者ID:v55448330,项目名称:eums,代码行数:16,代码来源:test_delivery_node.py

示例4: test_should_ignore_updates_to_quantity_on_non_root_node

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import quantity_in [as 别名]
    def test_should_ignore_updates_to_quantity_on_non_root_node(self):
        node_one = DeliveryNodeFactory()
        node = DeliveryNodeFactory(parents=[{'id': node_one.id, 'quantity': 7}])

        node.quantity = 50
        node.save()

        self.assertEqual(node.quantity_in(), 7)
开发者ID:v55448330,项目名称:eums,代码行数:10,代码来源:test_delivery_node.py

示例5: test_should_create_itself_with_parent_as_list_of_parent_quantity_tuples

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import quantity_in [as 别名]
    def test_should_create_itself_with_parent_as_list_of_parent_quantity_tuples(self):
        parent_one = DeliveryNodeFactory(quantity=100)
        parent_two = DeliveryNodeFactory(quantity=40)

        node = DeliveryNodeFactory(parents=[(parent_one, 50), (parent_two, 40)])

        self.assertEqual(node.quantity_in(), 90)
        self.assertEqual(parent_one.quantity_out(), 50)
        self.assertEqual(parent_two.quantity_out(), 40)
开发者ID:v55448330,项目名称:eums,代码行数:11,代码来源:test_delivery_node.py

示例6: test_should_update_delivery_node_parents

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import quantity_in [as 别名]
    def test_should_update_delivery_node_parents(self):
        node_one = DeliveryNodeFactory()
        node = DeliveryNodeFactory(parents=[{'id': node_one.id, 'quantity': 5}])

        changes = {'parents': [{'id': node_one.id, 'quantity': 8}]}
        path = '%s%d/' % (ENDPOINT_URL, node.id)
        response = self.client.patch(path, data=json.dumps(changes), content_type='application/json')

        self.assertEqual(response.status_code, 200)
        self.assertEqual(node.quantity_in(), 8)
开发者ID:unicefuganda,项目名称:eums,代码行数:12,代码来源:test_delivery_node_endpoint.py

示例7: test_update_should_leave_parents_intact_if_parents_are_not_specified

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import quantity_in [as 别名]
    def test_update_should_leave_parents_intact_if_parents_are_not_specified(self):
        node_one = DeliveryNodeFactory()
        node_two = DeliveryNodeFactory()

        node = DeliveryNodeFactory(parents=[{'id': node_one.id, 'quantity': 8}, {'id': node_two.id, 'quantity': 10}])

        node.location = 'Changed'
        node.save()
        self.assertEqual(node.quantity_in(), 18)
        self.assertEqual(node.location, 'Changed')
开发者ID:v55448330,项目名称:eums,代码行数:12,代码来源:test_delivery_node.py

示例8: test_update_quantity_to__zero_on_root_node

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import quantity_in [as 别名]
 def test_update_quantity_to__zero_on_root_node(self):
     node = DeliveryNodeFactory(quantity=100)
     node.quantity = 0
     node.save()
     self.assertEqual(node.quantity_in(), 0)
开发者ID:v55448330,项目名称:eums,代码行数:7,代码来源:test_delivery_node.py

示例9: test_update_quantity_on_root_node_should_update_quantity

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import quantity_in [as 别名]
 def test_update_quantity_on_root_node_should_update_quantity(self):
     node = DeliveryNodeFactory(quantity=100)
     node.quantity = 50
     node.save()
     self.assertEqual(node.quantity_in(), 50)
开发者ID:v55448330,项目名称:eums,代码行数:7,代码来源:test_delivery_node.py


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