testcontextualspacing.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # Copyright (C) 2017 Martijn Berntsen
  4. #
  5. # This is free software. You may redistribute it under the terms
  6. # of the Apache license and the GNU General Public License Version
  7. # 2 or at your option any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public
  15. # License along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. #
  18. # Contributor(s):
  19. #
  20. import unittest
  21. import os, sys
  22. from odf.opendocument import OpenDocumentText, load
  23. from odf import text
  24. from odf.namespaces import TEXTNS
  25. if sys.version_info[0]==3:
  26. unicode=str
  27. class TestConceptualspacing(unittest.TestCase):
  28. def test_contextualspacing(self):
  29. def printnodes(w, i):
  30. for p in w.childNodes:
  31. #if p.attributes <> None:
  32. for a in p.attributes:
  33. key, attr = a
  34. value = p.getAttribute(attr.replace('-', ''))
  35. printnodes(p, i + 1)
  36. """ Grab 1st paragraph and convert to string value """
  37. contextualspacing_odt = os.path.join(
  38. os.path.dirname(__file__), u"examples", u"contextualspacing.odt")
  39. d = load(contextualspacing_odt)
  40. #try:
  41. printnodes(d.styles, 0)
  42. # self.assertEqual(True, True)
  43. #except:
  44. # self.assertEqual(True, False)
  45. #self.assertEqual(shouldbe, unicode(d.body))
  46. if __name__ == '__main__':
  47. unittest.main()