| 1 |
schorsch |
1.1 |
|
| 2 |
|
|
import os |
| 3 |
|
|
import math |
| 4 |
|
|
import string |
| 5 |
|
|
import unittest |
| 6 |
|
|
|
| 7 |
|
|
from unit_tools import support |
| 8 |
|
|
from unit_tools import lcompare |
| 9 |
|
|
|
| 10 |
|
|
class LamTestCase(unittest.TestCase): |
| 11 |
|
|
def setUp(self): |
| 12 |
|
|
self.oldpath = os.environ['PATH'] |
| 13 |
|
|
os.environ['PATH'] = os.path.abspath(support.BINDIR) |
| 14 |
|
|
|
| 15 |
|
|
def tearDown(self): |
| 16 |
|
|
os.environ['PATH'] = self.oldpath |
| 17 |
|
|
|
| 18 |
|
|
def test_lam(self): |
| 19 |
|
|
dat_de = support.datafile('lam_de.dat') |
| 20 |
|
|
dat_en = support.datafile('lam_en.dat') |
| 21 |
schorsch |
1.2 |
cmd = 'rlam -t: "%s" "%s"' % (dat_de, dat_en) |
| 22 |
schorsch |
1.1 |
raw = os.popen(cmd).read() |
| 23 |
|
|
result = map(string.split,string.split(raw,'\n')) |
| 24 |
|
|
expect = [ |
| 25 |
|
|
['eins:one'], |
| 26 |
|
|
['zwei:two'], |
| 27 |
|
|
['drei:three'], |
| 28 |
|
|
['vier:four'], |
| 29 |
|
|
['fuenf:five'], |
| 30 |
|
|
] |
| 31 |
|
|
try: lcompare.llcompare(result, expect, ignore_empty=1) |
| 32 |
|
|
except lcompare.error, e: |
| 33 |
|
|
self.fail('%s [%s]' % (str(e),cmd)) |
| 34 |
|
|
|
| 35 |
|
|
def main(): |
| 36 |
|
|
support.run_case(LamTestCase) |
| 37 |
|
|
|
| 38 |
|
|
if __name__ == '__main__': |
| 39 |
|
|
main() |
| 40 |
|
|
|
| 41 |
|
|
# vi: set ts=4 sw=4 : |