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