From ea1520ede8fee5dfc2e9cbae5f7317f3deae79d2 Mon Sep 17 00:00:00 2001 From: milde Date: Sat, 4 Nov 2017 09:40:27 +0000 Subject: `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 --- test/test_nodes.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') 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, -- cgit v1.2.1