Phone number generator for libphonenumber
Project description
Phone Gen
Phone number generator for Google's libphonenumber library
This module was created exclusively for generating test data, when it is necessary to enter phone numbers in fields that are validated by the libphonenumber
library or its ports.
Installation
Install using pip with
pip install phone-gen
Example
from phone_gen import PhoneNumber
phone_number = PhoneNumber('GB')
# Get a phone number
number = phone_number.get_number()
print(number) # +442908124840
# Get a country code
country_code = phone_number.get_code()
print(country_code) # 44
# Get a phone number without a country code
number = phone_number.get_number(full=False)
print(number) # 183782623
pytest fixture
import pytest
from phone_gen import PhoneNumber
@pytest.fixture
def phone_number():
def wrap(code):
return PhoneNumber(code).get_number()
yield wrap
def test_one(phone_number):
number = phone_number('DE')
...
Resources
- libphonenumber
- Modified strgen library
Contributing
Contributions are very welcome.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for phone_gen-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edf39f0a2853fbf8b02cd271e14bce7b82267daeec5b0192796eefdc2458cc87 |
|
MD5 | 11a81be4fe57eefe5b78c641f8f2af11 |
|
BLAKE2b-256 | 5b1a1ccca74d77e67982730a0dddb9808809dce3808c76a462d6a76f75d4008e |