def test_default(self):
"""
Model Mommy: Plant.Item: YELLOW (raises IntegrityError)
There is no method used to create unique values so there are collisions
when there are a small number of possible values. Items that are
created are valid.
"""
with self.assertRaises(IntegrityError) as cm:
for expected_num_created in range(1, 25):
with transaction.atomic():
ItemFactory()
self.assertEqual(Item.objects.count(), expected_num_created - 1)
self.assertIn('unique', str(cm.exception).lower())
for item in Item.objects.all():
item.full_clean()
test_model_mommy_factories.py 文件源码
python
阅读 17
收藏 0
点赞 0
评论 0
评论列表
文章目录