Permalink
Browse files

blastoff: initial commit

  • Loading branch information...
0 parents commit 776f1daa832c7912f882b323ffe71cd34088bb7f @deepthawtz committed Feb 4, 2010
Showing with 193 additions and 0 deletions.
  1. +20 −0 LICENSE
  2. +54 −0 README
  3. +54 −0 faker/__init__.py
  4. +27 −0 setup.py
  5. +4 −0 test.py
  6. +34 −0 tests/test_api.py
20 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 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?

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -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",
+ )
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+import nose
+
+nose.run(["nosetests", "-s", "--with-coverage", "--cover-erase", "--cover-package=faker", "-d"])
@@ -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.