How to use the mimesis.enums.Gender function in mimesis

To help you get started, we’ve selected a few mimesis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lk-geimfari / mimesis / tests / test_providers / test_payment.py View on Github external
def test_credit_card_owner(self, p1, p2):
        assert p1.credit_card_owner() == p2.credit_card_owner()
        assert p1.credit_card_owner(gender=Gender.FEMALE) == \
            p2.credit_card_owner(gender=Gender.FEMALE)
github lk-geimfari / mimesis / tests / test_providers / test_person.py View on Github external
def test_surname(self, p1, p2):
        assert p1.surname() == p2.surname()
        assert p1.last_name(gender=Gender.MALE) == \
               p2.last_name(gender=Gender.MALE)
github lk-geimfari / mimesis / mimesis / providers / person.py View on Github external
def surname(self, gender: Optional[Gender] = None) -> str:
        """Generate a random surname.

        :param gender: Gender's enum object.
        :return: Surname.

        :Example:
            Smith.
        """
        surnames = self._data['surnames']

        # Surnames separated by gender.
        if isinstance(surnames, dict):
            key = self._validate_enum(gender, Gender)
            surnames = surnames[key]

        return self.random.choice(surnames)
github lk-geimfari / mimesis / mimesis / builtins / ru.py View on Github external
def patronymic(self, gender: Gender = None) -> str:
        """Generate random patronymic name.

        :param gender: Gender of person.
        :return: Patronymic name.

        :Example:
            Алексеевна.
        """
        gender = self._validate_enum(gender, Gender)
        patronymics = self._data['patronymic'][gender]
        return self.random.choice(patronymics)