summaryrefslogtreecommitdiff
path: root/_test/test_a_dedent.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2016-01-22 21:22:33 +0100
committerAnthon van der Neut <anthon@mnt.org>2016-01-22 21:22:33 +0100
commitda73c8aa0d8db3d0f54d88740a0f7f621ac563df (patch)
tree7cbbfec9780ab9a33f09926e91cab343be049cdb /_test/test_a_dedent.py
parenta5f03a5e66daaea85af2730fa961d11c62d8cf17 (diff)
downloadruamel.yaml-da73c8aa0d8db3d0f54d88740a0f7f621ac563df.tar.gz
moved test to _test to prevent setuptools from including test/test_*.py0.10.17
although the package dirs were explicitly specified. This used to lead to half included, non-working test directory contents that have no place in a distribution. This fixes issue #17
Diffstat (limited to '_test/test_a_dedent.py')
-rw-r--r--_test/test_a_dedent.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/_test/test_a_dedent.py b/_test/test_a_dedent.py
new file mode 100644
index 0000000..1362deb
--- /dev/null
+++ b/_test/test_a_dedent.py
@@ -0,0 +1,42 @@
+
+from roundtrip import dedent
+
+
+class TestDedent:
+ def test_start_newline(self):
+ x = dedent("""
+ 123
+ 456
+ """)
+ assert x == "123\n 456\n"
+
+ def test_start_space_newline(self):
+ # special construct to prevent stripping of following whitespac
+ x = dedent(" " """
+ 123
+ """)
+ assert x == "123\n"
+
+ def test_start_no_newline(self):
+ # special construct to prevent stripping of following whitespac
+ x = dedent("""\
+ 123
+ 456
+ """)
+ assert x == "123\n 456\n"
+
+ def test_preserve_no_newline_at_end(self):
+ x = dedent("""
+ 123""")
+ assert x == "123"
+
+ def test_preserve_no_newline_at_all(self):
+ x = dedent("""\
+ 123""")
+ assert x == "123"
+
+ def test_multiple_dedent(self):
+ x = dedent(dedent("""
+ 123
+ """))
+ assert x == "123\n"