-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New submodule “format.py” for string format functions
- Loading branch information
1 parent
8ec514a
commit 4898193
Showing
6 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*- coding: utf-8 -*- | ||
import unittest | ||
from tmep.format import alphanum, asciify, delchars | ||
|
||
|
||
class TestFormatFunctions(unittest.TestCase): | ||
|
||
def test_alphanum(self): | ||
self.assertEqual(alphanum('a-b'), 'a b') | ||
|
||
def test_asciify(self): | ||
self.assertEqual(asciify('ä'), 'ae') | ||
|
||
def test_delchars(self): | ||
self.assertEqual(delchars('a-b', '-'), 'ab') | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main(defaultTest='suite') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
"""A collection of string format functions derived form the class “Functions()” | ||
""" | ||
|
||
from tmep.functions import Functions | ||
|
||
f = Functions() | ||
|
||
# if = f.tmpl_if | ||
alphanum = f.tmpl_alphanum | ||
asciify = f.tmpl_asciify | ||
delchars = f.tmpl_delchars | ||
deldupchars = f.tmpl_deldupchars | ||
first = f.tmpl_first | ||
initial = f.tmpl_initial | ||
left = f.tmpl_left | ||
lower = f.tmpl_lower | ||
num = f.tmpl_num | ||
replchars = f.tmpl_replchars | ||
right = f.tmpl_right | ||
sanitize = f.tmpl_sanitize | ||
shorten = f.tmpl_shorten | ||
time = f.tmpl_time | ||
title = f.tmpl_title | ||
upper = f.tmpl_upper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters