Skip to content

Commit

Permalink
blastoff: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
deepthawtz committed Feb 4, 2010
0 parents commit 776f1da
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 0 deletions.
20 changes: 20 additions & 0 deletions LICENSE
@@ -0,0 +1,20 @@
Copyright (c) 2010 Dylan Clendenin

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
54 changes: 54 additions & 0 deletions README
@@ -0,0 +1,54 @@
..... ..
.H8888888x. '`+ < .z@8"`
:888888888888x. ! !@88E .u .
8~ `"*88888888" u '888E u .u .d88B :@8c
! . `f"""" us888u. 888E u@8NL ud8888. ="8888f8888r
~:...-` :8L <)88: .@88 "8888" 888E`"88*" :888'8888. 4888>'88"
. :888:>X88! 9888 9888 888E .dN. d888 '88%" 4888> '
:~"88x 48888X ^` 9888 9888 888E~8888 8888.+" 4888>
< :888k'88888X 9888 9888 888E '888& 8888L .d888L .+
d8888f '88888X 9888 9888 888E 9888. '8888c. .+ ^"8888*"
:8888! ?8888> "888*""888" '"888*" 4888" "88888% "Y"
X888! 8888~ ^Y" ^Y' "" "" "YP'
'888 X88f
'%8: .8*"
^----~"`

Faker
=====

A Python library for generating fake user data.
A port of Ruby's Faker library which is a port of Perl's Data::Faker library.

Usage
=====
>>> from faker import Faker
>>> f = Faker()
>>> f.name()
"Milli Vanilli"
>>> f.username()
"mvanilli"
>>> f.email()
"mvanilli@hotmail.com"

OR

>>> from faker import Faker
>>> f = Faker()
>>> for i in range(20):
... f.name()
... f.username()
... f.email()
...
"Dude Dudington"
"ddudington"
"ddudington@gmail.com"
"Kooky McKool"
"kmckool"
"kmckool@yahoo.com"
...etc...


Feedback
========
Any ideas where this should go? Features that would be useful? Bugs?
54 changes: 54 additions & 0 deletions faker/__init__.py

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions setup.py
@@ -0,0 +1,27 @@
#!/usr/bin/env python

from distutils.core import setup

setup(name="Faker",
version="0.0.1",
description="A port of Ruby's Faker library for generating fake user data",
long_description="Often you want to generate user data but without all the thinking and typing. This is a library for that.",
author="Dylan Clendenin",
author_email="dylan.clendenin@gmail.com",
url="http://github.com/deepthawtz/faker",
py_modules=["faker"],
platforms="any",
keywords="testing data generation",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Software Development :: Testing",
"Topic :: Utilities",
"License :: OSI Approved :: MIT License",
],
license="MIT",
)
4 changes: 4 additions & 0 deletions test.py
@@ -0,0 +1,4 @@
#!/usr/bin/env python
import nose

nose.run(["nosetests", "-s", "--with-coverage", "--cover-erase", "--cover-package=faker", "-d"])
34 changes: 34 additions & 0 deletions tests/test_api.py
@@ -0,0 +1,34 @@
import re

from faker import Faker

f = Faker()

def test_instance():
assert isinstance(f, Faker)

def test_fake_name():
pattern = re.compile(r"(\w+\.? ?){2,3}")
name = f.name()
assert pattern.match(name)

def test_username():
pattern = re.compile(r"^[a-z]*[^\s]$")
username = f.username()
assert pattern.match(username)

def test_fake_email():
pattern = re.compile(r".+@.+\.\w+")
email = f.email()
assert pattern.match(email)

def test_lorem():
pattern = re.compile(r"\w*")
paragraph = f.lorem()
assert pattern.match(paragraph)

def test_flow():
name = f.name()
_, last = name.split()
username = f.username()
assert username[1:] == last.lower()

0 comments on commit 776f1da

Please sign in to comment.