-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from barseghyanartur/dev
Improve tests. Allow to load ``Faker`` instances by ``uid`` or ``alias``.
- Loading branch information
Showing
7 changed files
with
77 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from fake import Factory, Faker | ||
|
||
from data import FIRST_NAMES, LAST_NAMES, WORDS | ||
|
||
__author__ = "Artur Barseghyan <artur.barseghyan@gmail.com>" | ||
__copyright__ = "2023 Artur Barseghyan" | ||
__license__ = "MIT" | ||
__all__ = ( | ||
"FACTORY", | ||
"FAKER", | ||
) | ||
|
||
|
||
class FakerOverrideDefaultData(Faker): | ||
"""Faker class for custom names and words.""" | ||
|
||
def load_names(self) -> None: | ||
"""Override default first- and last-names dictionaries.""" | ||
self._first_names = FIRST_NAMES | ||
self._last_names = LAST_NAMES | ||
|
||
def load_words(self) -> None: | ||
"""Override default words dictionary.""" | ||
self._words = WORDS | ||
|
||
|
||
FAKER = FakerOverrideDefaultData(alias="override_default_data") | ||
FACTORY = Factory(FAKER) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters