本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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')
示例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)
示例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)