本文整理汇总了Python中eums.test.factories.delivery_node_factory.DeliveryNodeFactory.parents方法的典型用法代码示例。如果您正苦于以下问题:Python DeliveryNodeFactory.parents方法的具体用法?Python DeliveryNodeFactory.parents怎么用?Python DeliveryNodeFactory.parents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eums.test.factories.delivery_node_factory.DeliveryNodeFactory
的用法示例。
在下文中一共展示了DeliveryNodeFactory.parents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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 parents [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)
示例2: 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 parents [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)