3 from translate
.storage
import tbx
4 from translate
.storage
import test_base
6 class TestTBXUnit(test_base
.TestTranslationUnit
):
7 UnitClass
= tbx
.tbxunit
10 class TestTBXfile(test_base
.TestTranslationStore
):
11 StoreClass
= tbx
.tbxfile
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
))
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
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
))
30 assert newfile
.findunit("Concept") is None
31 assert newfile
.findunit("Term") is not None
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
))
39 assert newfile
.findunit("Concept").target
== "Konsep"