Skip to content

Doubt in usage of polyfactory #524

Closed Answered by Alc-Alc
vickypalani asked this question in Q&A
Discussion options

You must be logged in to vote

Can you try this?

from polyfactory import Use
class RoleTypeFactory(BaseFactory):
    """
    RoleType Factory
    """
    __model__ = neo_hire_models.RoleType

    id = Ignore()
    name = Use(lambda: Faker().name())

I would recommend name = Use(lambda: RoleTypeFactory.__faker__.name()) instead of creating your own faker

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by vickypalani
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #523 on April 15, 2024 14:50.