Package translate :: Package storage :: Module test_tbx
[hide private]
[frames] | no frames]

Source Code for Module translate.storage.test_tbx

 1  #!/usr/bin/env python 
 2   
 3  from translate.storage import tbx 
 4  from translate.storage import test_base 
 5   
6 -class TestTBXUnit(test_base.TestTranslationUnit):
7 UnitClass = tbx.tbxunit
8 9
10 -class TestTBXfile(test_base.TestTranslationStore):
11 StoreClass = tbx.tbxfile
12 - def test_basic(self):
13 tbxfile = tbx.tbxfile() 14 assert tbxfile.units == [] 15 tbxfile.addsourceunit("Bla") 16 assert len(tbxfile.units) == 1 17 newfile = tbx.tbxfile.parsestring(str(tbxfile)) 18 print str(tbxfile) 19 assert len(newfile.units) == 1 20 assert newfile.units[0].source == "Bla" 21 assert newfile.findunit("Bla").source == "Bla" 22 assert newfile.findunit("dit") is None
23
24 - def test_source(self):
25 tbxfile = tbx.tbxfile() 26 tbxunit = tbxfile.addsourceunit("Concept") 27 tbxunit.source = "Term" 28 newfile = tbx.tbxfile.parsestring(str(tbxfile)) 29 print str(tbxfile) 30 assert newfile.findunit("Concept") is None 31 assert newfile.findunit("Term") is not None
32
33 - def test_target(self):
34 tbxfile = tbx.tbxfile() 35 tbxunit = tbxfile.addsourceunit("Concept") 36 tbxunit.target = "Konsep" 37 newfile = tbx.tbxfile.parsestring(str(tbxfile)) 38 print str(tbxfile) 39 assert newfile.findunit("Concept").target == "Konsep"
40