Package translate :: Package storage :: Module test_odf

[hide private]
[frames] | no frames]

# Source Code for Module translate.storage.test_odf

     1  #!/usr/bin/env python
     2
     3  from translate.storage import odf
     4  from translate.storage import test_monolingual
     5  from translate.misc import wStringIO
     6
     7 -class TestODFUnit(test_monolingual.TestMonolingualUnit):
     8      UnitClass = odf.ODFUnit
     9
    10  #    def test_markreview(self):
    11  #        assert test.raises(NotImplementedError, self.unit.markreviewneeded)
    12
    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
    20
    21 -    def odfregen(self, odfsource):
    22          """helper that converts odf source to odffile object and back"""
    23          return str(self.odfparse(odfsource))
    24
    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
    32  #
    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
    43