Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add enum provider #1729

Merged
merged 3 commits into from
Oct 11, 2022
Merged

Add enum provider #1729

merged 3 commits into from
Oct 11, 2022

Conversation

NazarioJL
Copy link
Contributor

What does this change

Adds an enum provider to allow users to generate values based on enums.

Usage:

from enum import Enum

from faker import Faker


class Color(Enum):
    RED = 1
    GREEN = 2
    BLUE = 3


fake = Faker()
fake.enum(Color)
# One of [Color.RED, Color.GREEN, Color.BLUE]

Copy link
Collaborator

@fcurella fcurella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks really good!

Copy link
Collaborator

@fcurella fcurella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you run make lint to fix the formatting issues?

@NazarioJL
Copy link
Contributor Author

@fcurella need me to do anything else?

@fcurella
Copy link
Collaborator

No, thank you. I'll take it form here and fix the mypy issues :)

@fcurella fcurella merged commit 490a744 into joke2k:master Oct 11, 2022
@NazarioJL NazarioJL deleted the add_faker_enum branch October 11, 2022 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants