[Python-modules-commits] [python-odf] 73/118: Tests for string-value of elements

Wolfgang Borgert debacle at moszumanska.debian.org
Fri Oct 3 21:27:24 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 59e1f90948e511c43fea89b3bb2a83985ed37d03
Author: Søren Roug <soren.roug at eea.europa.eu>
Date:   Thu Dec 31 15:52:40 2009 +0000

    Tests for string-value of elements
---
 tests/testtext.py  | 12 +++++++++++-
 tests/testtypes.py |  6 +-----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/tests/testtext.py b/tests/testtext.py
index ad319cb..c047233 100644
--- a/tests/testtext.py
+++ b/tests/testtext.py
@@ -19,7 +19,8 @@
 #
 
 import unittest
-from odf.opendocument import OpenDocumentText
+import os
+from odf.opendocument import OpenDocumentText, load
 from odf import text
 from odf.namespaces import TEXTNS
 
@@ -32,6 +33,15 @@ class TestText(unittest.TestCase):
         textdoc.text.addElement(spb)
         self.assertEquals(1, 1)
 
+    def test_1stpara(self):
+        """ Grab 1st paragraph and convert to string value """
+        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."
+        self.assertEquals(shouldbe, unicode(d.body))
+        self.assertEquals(shouldbe, str(d.body))
+
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/tests/testtypes.py b/tests/testtypes.py
index 238a61e..a63cee2 100644
--- a/tests/testtypes.py
+++ b/tests/testtypes.py
@@ -19,14 +19,10 @@
 #
 
 import unittest, os
-import cStringIO
-import zipfile
-from odf import teletype
-from odf.opendocument import OpenDocumentText, load
+from odf.opendocument import load
 from odf import office, text
 
 class TestTypes(unittest.TestCase):
-    
 
 
     def test_paras(self):

-- 
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