Skip to content

Commit

Permalink
Improve docstrings of build/create classmethods
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos authored Jan 17, 2024
1 parent eda5022 commit f5dd98a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions factory/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,18 @@ def _create(cls, model_class, *args, **kwargs):

@classmethod
def build(cls, **kwargs):
"""Build an instance of the associated class, with overridden attrs."""
"""Build an instance of the associated class, with overridden attrs.
The instance will not be saved and persisted to any datastore.
"""
return cls._generate(enums.BUILD_STRATEGY, kwargs)

@classmethod
def build_batch(cls, size, **kwargs):
"""Build a batch of instances of the given class, with overridden attrs.
The instances will not be saved and persisted to any datastore.
Args:
size (int): the number of instances to build
Expand All @@ -524,13 +529,18 @@ def build_batch(cls, size, **kwargs):

@classmethod
def create(cls, **kwargs):
"""Create an instance of the associated class, with overridden attrs."""
"""Create an instance of the associated class, with overridden attrs.
The instance will be saved and persisted in the appropriate datastore.
"""
return cls._generate(enums.CREATE_STRATEGY, kwargs)

@classmethod
def create_batch(cls, size, **kwargs):
"""Create a batch of instances of the given class, with overridden attrs.
The instances will be saved and persisted in the appropriate datastore.
Args:
size (int): the number of instances to create
Expand Down

0 comments on commit f5dd98a

Please sign in to comment.