Elizabeth

Elizabeth is a fast and easy to use Python library for generating dummy data for a variety of purposes. This data can be particularly useful during software development and testing. For example, it could be used to populate a testing database for a web application with user information such as email addresses, usernames, first names, last names, etc.

There are over eighteen different data providers available, which can produce data related to food, people, computer hardware, transportation, addresses, and more. Elizabeth does not require any modules that are not in the Python standard library.

Best Practice

We strongly recommend to read articles which published in our blog on Medium. There we are speak about best practices and a number of most useful features of the library.

Generating mock data using Elizabeth: First and Second part.

Installation

➜ git clone https://github.com/lk-geimfari/elizabeth.git
➜ cd elizabeth/
➜ make install

or simply:

➜ pip install elizabeth

Basic Usage

>>> from elizabeth import Personal
>>> p = Personal()

>>> p.full_name(gender='female')
'Antonetta Garrison'

>>> p.blood_type()
'O-'

>>> p.occupation()
'Programmer'

Locales

You can specify a locale when creating providers and they will return data that is appropriate for the language or country associated with that locale. Elizabeth currently includes support for 30 different locales:

Code Name Native Name
cs Czech Česky
da Danish Dansk
de German Deutsch
de-at Austrian german Deutsch
de-ch Swiss german Deutsch
en English English
en-au Australian English English
en-ca Canadian English English
en-gb British English English
es Spanish Español
es Mexican Spanish Español
fa Farsi فارسی
fi Finnish Suomi
fr French Français
hu Hungarian Magyar
is Icelandic Íslenska
it Italian Italiano
jp Japanese 日本語
ko Korean 한국어
nl Dutch Nederlands
nl-be Belgium Dutch Nederlands
no Norwegian Norsk
pl Polish Polski
pt Portuguese Português
pt-br Brazilian Portuguese Português Brasileiro
ru Russian Русский
sv Swedish Svenska
tr Turkish Türkçe
uk Ukrainian Український
zh Chinese 汉语

Usage

>>> from elizabeth import Text
>>> en = Text('en')
>>> de = Text('de')

>>> en.sentence()
'Ports are used to communicate with the external world.'

>>> de.sentence()
'Wir müssen nicht vergessen Zickler.'

>>> en.color()
'Blue'

>>> de.color()
'Türkis'

When you only need to generate data for a single locale, use the Generic provider, and you can access all Elizabeth providers from one object.

>>> from elizabeth import Generic
>>> g = Generic('es')

>>> g.datetime.month()
'Agosto'

>>> g.code.imei()
'353918052107063'

>>> g.food.fruit()
'Limón'

Contributing

The source code and issue tracker are hosted on GitHub. Elizabeth is tested against Python 3.2 through 3.6 on Travis-CI. Test coverage is monitored with Codecov, and code quality checks are automated with Codacy.

Guidelines

Your contributions are always welcome! Please adhere to the contribution guidelines:

  • Add one change per one commit.
  • Include only commit in each pull request.
  • Document your code with comments in English.
  • Check your spelling and grammar.
  • Check code style with pycodestyle, pylint, or another similar tool.
  • Run the test suite and ensure all tests pass.
  • Write additional tests to cover new functionality.
  • Do not write bad code!

Running Tests

cd elizabeth/
py.test --cov=elizabeth/ --cov-report=term-missing

or

make test

License and Disclaimer

Elizabeth is distributed under the MIT License.

The authors do not assume any responsibility for how you use this library or how you use data generated with it. This library is designed only for developers and only with good intentions. Do not use the data generated with Elizabeth for illegal purposes.