本文整理汇总了Python中eums.test.factories.delivery_node_factory.DeliveryNodeFactory.quantity方法的典型用法代码示例。如果您正苦于以下问题:Python DeliveryNodeFactory.quantity方法的具体用法?Python DeliveryNodeFactory.quantity怎么用?Python DeliveryNodeFactory.quantity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eums.test.factories.delivery_node_factory.DeliveryNodeFactory
的用法示例。
在下文中一共展示了DeliveryNodeFactory.quantity方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_should_delete_tracked_node_on_update_with_zero_quantity
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import quantity [as 别名]
def test_should_delete_tracked_node_on_update_with_zero_quantity(self):
node = DeliveryNodeFactory(quantity=10, track=True)
self.assertEqual(DeliveryNode.objects.count(), 1)
node.quantity = 0
returned_node = node.save()
self.assertEqual(DeliveryNode.objects.count(), 0)
self.assertTrue(isinstance(returned_node, DeliveryNode))
示例2: 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 [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)
示例3: 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 [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)
示例4: test_should_know_if_it_is_fully_delivered_or_not_using_only_tracked_nodes
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import quantity [as 别名]
def test_should_know_if_it_is_fully_delivered_or_not_using_only_tracked_nodes(self):
purchase_order = PurchaseOrderFactory()
item_one = PurchaseOrderItemFactory(purchase_order=purchase_order, quantity=100)
item_two = PurchaseOrderItemFactory(purchase_order=purchase_order, quantity=100)
self.assertFalse(purchase_order.is_fully_delivered())
delivery = DeliveryFactory()
node_one = NodeFactory(item=item_one, quantity=100, distribution_plan=delivery)
self.assertFalse(purchase_order.is_fully_delivered())
node_two = NodeFactory(item=item_two, quantity=100, distribution_plan=delivery)
self.assertFalse(purchase_order.is_fully_delivered())
delivery.track = True
delivery.save()
node_two.quantity = 50
node_two.save()
self.assertFalse(purchase_order.is_fully_delivered())
node_two.quantity = 100
node_two.save()
self.assertTrue(purchase_order.is_fully_delivered())
示例5: 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 [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)
示例6: 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 [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)