ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/test/py_tests/test_lam.py
Revision: 1.4
Committed: Mon Mar 28 17:48:43 2016 UTC (8 years, 1 month ago) by schorsch
Content type: text/x-python
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +0 -0 lines
State: FILE REMOVED
Log Message:
Refactoring of test suite, use independently of SCons and with Py2.7 or 3.x.

File Contents

# Content
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 _bindir = None
11
12 class LamTestCase(unittest.TestCase):
13 def setUp(self):
14 if _bindir:
15 self.oldpath = os.environ['PATH']
16 os.environ['PATH'] = _bindir
17
18 def tearDown(self):
19 if _bindir:
20 os.environ['PATH'] = self.oldpath
21
22 def test_lam(self):
23 dat_de = support.datafile('lam_de.dat')
24 dat_en = support.datafile('lam_en.dat')
25 cmd = 'rlam -t: "%s" "%s"' % (dat_de, dat_en)
26 raw = os.popen(cmd).read()
27 result = map(string.split,string.split(raw,'\n'))
28 expect = [
29 ['eins:one'],
30 ['zwei:two'],
31 ['drei:three'],
32 ['vier:four'],
33 ['fuenf:five'],
34 ]
35 try: lcompare.llcompare(result, expect, ignore_empty=1)
36 except lcompare.error, e:
37 self.fail('%s [%s]' % (str(e),cmd))
38
39 def main(bindir=None):
40 global _bindir
41 _bindir=bindir
42 support.run_case(LamTestCase)
43
44 if __name__ == '__main__':
45 main()
46
47 # vi: set ts=4 sw=4 :