summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2017-11-04 09:40:27 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2017-11-04 09:40:27 +0000
commitea1520ede8fee5dfc2e9cbae5f7317f3deae79d2 (patch)
tree4d27e56a8a587d309b3cdd38309648ff7f4fa9f0 /test
parent5d8bc3d69391c3f89b50622bbe71a00daa926dac (diff)
downloaddocutils-ea1520ede8fee5dfc2e9cbae5f7317f3deae79d2.tar.gz
`Text.rstrip` and `Text.lstrip` now handle `rawsource` attribute.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@8194 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_nodes.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_nodes.py b/test/test_nodes.py
index da5b93e2e..557078c77 100755
--- a/test/test_nodes.py
+++ b/test/test_nodes.py
@@ -54,6 +54,15 @@ class TextTests(unittest.TestCase):
self.assertTrue(isinstance(self.text.pformat(), unicode))
self.assertEqual(self.text.pformat(), u'Line 1.\nLine 2.\n')
+ def test_strip(self):
+ text = nodes.Text(' was noch ', ' \was\ noch \\ ')
+ stripped = text.lstrip().rstrip()
+ stripped2 = text.lstrip(' wahn').rstrip(' wahn')
+ self.assertEqual(stripped, u'was noch')
+ self.assertEqual(stripped.rawsource, u'\was\\ noch')
+ self.assertEqual(stripped2, u's noc')
+ self.assertEqual(stripped2.rawsource, u's\\ noc')
+
def test_asciirestriction(self):
if sys.version_info < (3,):
self.assertRaises(UnicodeDecodeError, nodes.Text,