ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/test/testcases/util/test_getinfo.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
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 GetinfoTestCase(unittest.TestCase, ProcMixin):
12    
13     def _runit(self, cmd):
14     try:
15     proc = self.call_one(cmd, 'call getinfo', 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_headers(raw)
23    
24     def test_getinfo(self):
25     picfile = ts.datafile('Earth128.pic')
26     cmd = ['getinfo', picfile]
27     result = self._runit(cmd)
28     exps = '''%s:
29     Xim format conversion by:
30     FORMAT=32-bit_rle_rgbe
31     pfilt -e 2 -x 512 -y 512 -p 1 -r .67
32     EXPOSURE=4.926198e+00
33     normpat
34     pfilt -1 -e .2
35     EXPOSURE=2.000000e-01
36     pfilt -x 128 -y 128
37     PIXASPECT=0.500000
38     EXPOSURE=2.571646e+00''' % picfile
39     expect = lcompare.split_headers(exps)
40     try: lcompare.llcompare(result, expect, ignore_empty=1)
41     except lcompare.error as e:
42     self.fail('%s [%s]' % (str(e),cmd))
43    
44     def test_getinfo_d(self):
45     picfile = ts.datafile('Earth128.pic')
46     cmd = ['getinfo', '-d', picfile]
47     result = self._runit(cmd)
48     exps = '''%s: -Y 128 +X 128''' % picfile
49     expect = lcompare.split_headers(exps)
50     try: lcompare.llcompare(result, expect, ignore_empty=1)
51     except lcompare.error as e:
52     self.fail('%s [%s]' % (str(e),cmd))
53    
54    
55     # vi: set ts=4 sw=4 :