aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/formatting.py
diff options
context:
space:
mode:
authorSam2013-05-23 00:22:54 +0000
committerSam2013-05-23 00:22:54 +0000
commit7eb9f5d12389df0ef7440a82df0be9bd1119847e (patch)
tree3e81009fa50e1de0bdb10064695cb6179eb94be6 /wqflask/utility/formatting.py
parent66e8d76ea34b6784a451abe3223eb13107d4307f (diff)
downloadgenenetwork2-7eb9f5d12389df0ef7440a82df0be9bd1119847e.tar.gz
Lots of changes around users
Diffstat (limited to 'wqflask/utility/formatting.py')
-rw-r--r--wqflask/utility/formatting.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/wqflask/utility/formatting.py b/wqflask/utility/formatting.py
index 52173417..e53dda22 100644
--- a/wqflask/utility/formatting.py
+++ b/wqflask/utility/formatting.py
@@ -10,6 +10,14 @@ def numify(number, singular=None, plural=None):
>>> numify(9, 'book', 'books')
'nine books'
+ You can add capitalize to change the capitalization
+ >>> numify(9, 'book', 'books').capitalize()
+ 'Nine books'
+
+ Or capitalize every word using title
+ >>> numify(9, 'book', 'books').title()
+ 'Nine Books'
+
>>> numify(15)
'15'
@@ -107,3 +115,8 @@ def commify(n):
if cents:
out += '.' + cents
return out
+
+
+if __name__ == '__main__':
+ import doctest
+ doctest.testmod()