annotate tests/test_decorators.py @ 50:1284c99a94fa

stubbing
author Jeff Hammel <k0scist@gmail.com>
date Sat, 16 May 2015 21:02:07 -0700
parents ead4d5877b8f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env python
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3 import os
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4 import unittest
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5 from textshaper.decorator import lines
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
7 class TestDecorators(unittest.TestCase):
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8 """test decorator(s) for textshaper"""
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
9
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
10 def test_lines(self):
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
11 """test line decorator"""
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13 @lines
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
14 def upper_case(text):
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
15 return [line.upper() for line in text]
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
16
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
17 content = """the quick brown fox
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
18 jumped over
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
19 the lazy dog"""
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
20
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
21 _lines = content.splitlines()
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
22
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
23 self.assertEqual(upper_case(content), """THE QUICK BROWN FOX
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
24 JUMPED OVER
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
25 THE LAZY DOG""")
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
26 self.assertEqual(upper_case(_lines), ["THE QUICK BROWN FOX",
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
27 "JUMPED OVER",
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
28 "THE LAZY DOG"])
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
29
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
30 if __name__ == '__main__':
ead4d5877b8f STUB: tests/test_decorators.py
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
31 unittest.main()