[Python-modules-commits] [python-odf] 91/118: Fixed the unit tests

Wolfgang Borgert debacle at moszumanska.debian.org
Fri Oct 3 21:27:27 UTC 2014


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to reference refs/remotes/upstream/master
in repository python-odf.

commit ab365c1c0299b9e97e8c28be3815e88b639efc83
Author: Søren Roug <soren.roug at eea.europa.eu>
Date:   Tue May 18 19:46:34 2010 +0000

    Fixed the unit tests
---
 odf/load.py             | 2 +-
 tests/testtext.py       | 2 +-
 tests/testwhitespace.py | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/odf/load.py b/odf/load.py
index cdcc794..e48fcaa 100644
--- a/odf/load.py
+++ b/odf/load.py
@@ -64,7 +64,7 @@ class LoadParser(handler.ContentHandler):
         self.level = self.level + 1
         # Add any accumulated text content
         content = ''.join(self.data)
-        if len(content) > 0:
+        if len(content.strip()) > 0:
             self.parent.addText(content, check_grammar=False)
             self.data = []
         # Create the element
diff --git a/tests/testtext.py b/tests/testtext.py
index c047233..6a3aee3 100644
--- a/tests/testtext.py
+++ b/tests/testtext.py
@@ -38,7 +38,7 @@ class TestText(unittest.TestCase):
         poem_odt = os.path.join(
             os.path.dirname(__file__), "examples", "serious_poem.odt")
         d = load(poem_odt)
-        shouldbe = u"The boy stoodon the burning deck,Whence allbuthim had fled.The flamesthat litthe battle'swreck,Shone o'er him, round the dead."
+        shouldbe = u"The boy stood on the burning deck,Whence allbuthim had fled.The flames that litthe battle'swreck,Shone o'er him, round the dead. "
         self.assertEquals(shouldbe, unicode(d.body))
         self.assertEquals(shouldbe, str(d.body))
 
diff --git a/tests/testwhitespace.py b/tests/testwhitespace.py
index 3890c52..9d592f3 100644
--- a/tests/testwhitespace.py
+++ b/tests/testwhitespace.py
@@ -51,9 +51,9 @@ class TestWhite(unittest.TestCase):
             os.path.dirname(__file__), "examples", "serious_poem.odt")
         d = load(poem_odt)
         allparas = d.getElementsByType(P)
-        content = """<text:p text:style-name="Standard">The boy stood<text:s text:c="3"/>on the burning deck,<text:line-break/><text:tab/>Whence all<text:tab/>but<text:tab/><text:tab/>him had fled.<text:line-break/>The flames<text:s text:c="2"/>that lit<text:tab/>the battle's<text:tab/>wreck,<text:line-break/><text:s text:c="11"/>Shone o'er him, round the dead.<text:s text:c="2"/></text:p>"""
+        content = """<text:p text:style-name="Standard">The boy stood <text:s text:c="3"/>on the burning deck,<text:line-break/><text:tab/>Whence all<text:tab/>but<text:tab/><text:tab/>him had fled.<text:line-break/>The flames <text:s text:c="2"/>that lit<text:tab/>the battle's<text:tab/>wreck,<text:line-break/> <text:s text:c="11"/>Shone o'er him, round the dead. <text:s text:c="2"/></text:p>"""
 
-        self.assertEqual(u"The boy stood   on the burning deck,\n\tWhence all\tbut\t\thim had fled.\nThe flames  that lit\tthe battle's\twreck,\n           Shone o'er him, round the dead.  ", teletype.extractText(allparas[0]))
+        self.assertEqual(u"The boy stood    on the burning deck,\n\tWhence all\tbut\t\thim had fled.\nThe flames   that lit\tthe battle's\twreck,\n           Shone o'er him, round the dead.   ", teletype.extractText(allparas[0]))
 
     def test_extract_with_span(self):
         """ Extract a text with a bold/italic span """

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-odf.git



More information about the Python-modules-commits mailing list