Skip to content

Commit 9d3dc9d

Browse files
committed
added tox config + docs
1 parent 2afe602 commit 9d3dc9d

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

MANIFEST

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# file GENERATED by distutils, do NOT edit
2+
setup.py

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
A small utility library for strings.
44

55
- simple and pythonic
6+
- no external dependencies
7+
- fully documented
68
- PEP8 complaint
79
- 100% code coverage
8-
- works with python 2.7+ and 3+
10+
- tested against multiple python versions (2.7, 3.2, 3.3, 3.4)

setup.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from distutils.core import setup
2+
3+
setup(
4+
name='python-string-utils',
5+
version='0.0.0',
6+
description='Utility functions for strings',
7+
author='Davide Zanotti',
8+
author_email='davidezanotti@gmail.com',
9+
# url='https://www.python.org/sigs/distutils-sig/',
10+
)

string_utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ def is_email(string):
5050

5151

5252
def is_credit_card(string, card_type=None):
53+
"""
54+
Checks if a string is a valid credit card number.
55+
If card type is provided then it checks that specific type,
56+
otherwise any known credit card number will be accepted.
57+
58+
:param string: String to check.
59+
:param card_type: Card type (can be: 'VISA', 'MASTERCARD', 'AMERICAN_EXPRESS', 'DINERS_CLUB', 'DISCOVER', 'JCB'
60+
or None). Default to None (any card).
61+
:return: :raise KeyError:
62+
"""
5363
if card_type:
5464
if card_type not in CREDIT_CARDS:
5565
raise KeyError(

tox.ini

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Tox (http://tox.testrun.org/) is a tool for running tests
2+
# in multiple virtualenvs. This configuration file will run the
3+
# test suite on all supported python versions. To use it, "pip install tox"
4+
# and then run "tox" from this directory.
5+
6+
[tox]
7+
envlist = py27, py32, py33, py34
8+
# py35, pypy, jython
9+
10+
[testenv]
11+
commands = python -m unittest discover

0 commit comments

Comments
 (0)