From dca3a16e9a4f731a3fe217e0ef6fa558796110aa Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Wed, 17 Jan 2024 08:59:23 +0100 Subject: [PATCH] Improve docstrings of `build`/`create` classmethods --- factory/base.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/factory/base.py b/factory/base.py index 8d499501..454513be 100644 --- a/factory/base.py +++ b/factory/base.py @@ -510,13 +510,18 @@ def _create(cls, model_class, *args, **kwargs): @classmethod def build(cls, **kwargs) -> T: - """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: int, **kwargs) -> List[T]: """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 @@ -527,13 +532,18 @@ def build_batch(cls, size: int, **kwargs) -> List[T]: @classmethod def create(cls, **kwargs) -> T: - """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: int, **kwargs) -> List[T]: """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