fix git support for v1.5.3 (or higher) by setting "--work-tree"
[translate_toolkit.git] / storage / test_odf.py
blob7e2fea1a653b70fab4e2c5e372f3799579e717d7
1 #!/usr/bin/env python
3 from translate.storage import odf
4 from translate.storage import test_monolingual
5 from translate.misc import wStringIO
7 class TestODFUnit(test_monolingual.TestMonolingualUnit):
8 UnitClass = odf.ODFUnit
10 # def test_markreview(self):
11 # assert test.raises(NotImplementedError, self.unit.markreviewneeded)
13 class TestODFFile(test_monolingual.TestMonolingualStore):
14 StoreClass = odf.ODFFile
15 def odfparse(self, odfsource):
16 """helper that parses odf source without requiring files"""
17 dummyfile = wStringIO.StringIO(odfsource)
18 odffile = self.StoreClass(dummyfile)
19 return odffile
21 def odfregen(self, odfsource):
22 """helper that converts odf source to odffile object and back"""
23 return str(self.odfparse(odfsource))
25 # def test_simpleblock(self):
26 # """checks that a simple odf block is parsed correctly"""
27 # odfsource = 'bananas for sale'
28 # odffile = self.odfparse(odfsource)
29 # assert len(odffile.units) == 1
30 # assert odffile.units[0].source == odfsource
31 # assert self.odfregen(odfsource) == odfsource
33 # def test_multipleblocks(self):
34 # """ check that multiple blocks are parsed correctly"""
35 # odfsource = '''One\nOne\n\nTwo\n---\n\nThree'''
36 # odffile = self.odfparse(odfsource)
37 # assert len(odffile.units) == 3
38 # print odfsource
39 # print str(odffile)
40 # print "*%s*" % odffile.units[0]
41 # assert str(odffile) == odfsource
42 # assert self.odfregen(odfsource) == odfsource