Django Factory Boy Create vs create_batch
Asked Answered
S

1

6

I am learning django test and i found django factory boy library very helpfull for writing testcase but one thing i am not getting..

forexample my one of Factory name is BlogFactory

so i notice, most of the people use this like this: BlogFactory.create() and some people use it like this.. BlogFactory.create_batch() I am not getting difference between it..

What is different between create and create_batch ?

Swordbill answered 22/6, 2019 at 16:9 Comment(0)
D
11

The create_batch method of a factory cannot be called without parameters as create(), since size is required by design (see the docs link above).

Disrepair answered 22/6, 2019 at 19:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.