ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/test/testcases/cal/test_lam.py
Revision: 1.1
Committed: Mon Mar 28 17:48:43 2016 UTC (9 years, 1 month ago) by schorsch
Content type: text/x-python
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad5R3, HEAD
Log Message:
Refactoring of test suite, use independently of SCons and with Py2.7 or 3.x.

File Contents

# User Rev Content
1 schorsch 1.1 # -*- coding: utf-8 -*-
2     from __future__ import division, print_function, unicode_literals
3    
4     import unittest
5    
6     import testsupport as ts
7     from pyradlib import lcompare
8     from pyradlib.pyrad_proc import PIPE, Error, ProcMixin
9    
10    
11     class LamTestCase(unittest.TestCase, ProcMixin):
12    
13     def _runit(self, cmd):
14     try:
15     proc = self.call_one(cmd, 'call rlam', out=PIPE,
16     universal_newlines=True)
17     raw = proc.stdout.read()
18     except Error as e:
19     self.fail('%s [%s]' % (str(e), self.qjoin(cmd)))
20     finally:
21     proc.wait()
22     return lcompare.split_rad(raw)
23    
24     def test_lam(self):
25     dat_de = ts.datafile('lam_de.dat')
26     dat_en = ts.datafile('lam_en.dat')
27     cmd = ['rlam', '-t:', dat_de, dat_en]
28     result = self._runit(cmd)
29     expect = [
30     ['eins:one'],
31     ['zwei:two'],
32     ['drei:three'],
33     ['vier:four'],
34     ['fuenf:five'],
35     ]
36     try: lcompare.llcompare(result, expect, ignore_empty=1)
37     except lcompare.error as e:
38     self.fail('%s [%s]' % (str(e),cmd))
39    
40    
41     # vi: set ts=4 sw=4 :