Mercurial > hg > TextShaper
annotate tests/test_indent.py @ 57:a2bbe406f570 default tip
which is no longer maintained; roll our mediocre own
| author | Jeff Hammel <k0scist@gmail.com> |
|---|---|
| date | Mon, 20 Feb 2017 10:40:34 -0800 |
| parents | 23616399f36c |
| children |
| rev | line source |
|---|---|
|
31
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
2 |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
3 import os |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
4 import unittest |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
5 from textshaper.indent import indent |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
6 |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
7 class TestIndentation(unittest.TestCase): |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
8 """test textshaper indentation functionality""" |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
9 |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
10 def test_indent(self): |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
11 text = """The quick brown fox |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
12 jumped over |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
13 the lazy dog.""" |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
14 |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
15 self.assertEqual(indent(text, indentation=4), """ The quick brown fox |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
16 jumped over |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
17 the lazy dog.""") |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
18 |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
19 if __name__ == '__main__': |
|
23616399f36c
make indent a @lines function and test
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
20 unittest.main() |
