# HG changeset patch # User Jeff Hammel # Date 1393195720 28800 # Node ID 23616399f36c6e3137085f62e189340dc7682689 # Parent ead4d5877b8f011f6cbb2a008ead119a1bc38792 make indent a @lines function and test diff -r ead4d5877b8f -r 23616399f36c tests/test_indent.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_indent.py Sun Feb 23 14:48:40 2014 -0800 @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +import os +import unittest +from textshaper.indent import indent + +class TestIndentation(unittest.TestCase): + """test textshaper indentation functionality""" + + def test_indent(self): + text = """The quick brown fox + jumped over + the lazy dog.""" + + self.assertEqual(indent(text, indentation=4), """ The quick brown fox + jumped over + the lazy dog.""") + +if __name__ == '__main__': + unittest.main() diff -r ead4d5877b8f -r 23616399f36c textshaper/indent.py --- a/textshaper/indent.py Sun Feb 23 14:29:44 2014 -0800 +++ b/textshaper/indent.py Sun Feb 23 14:48:40 2014 -0800 @@ -7,7 +7,9 @@ import argparse import os import sys +from .decorator import lines +@lines def indent(text, indentation=4, space=' ', strict=False): """ indent a block of text