ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/test/testcases/gen/test_xform.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

# Content
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 XformTestCase(unittest.TestCase, ProcMixin):
12
13 def _runit(self, cmd):
14 try:
15 proc = self.call_one(cmd, 'call xform', 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_xform_e_s(self):
25 cmd = 'xform -e -s 3.14159'.split() + [ts.datafile('xform_1.dat')]
26 result = self._runit(cmd)
27 expect = lcompare.split_radfile(ts.datafile('xform_res1.dat'))
28 try: lcompare.llcompare(result, expect, ignore_empty=1)
29 except lcompare.error as e:
30 self.fail('%s [%s]' % (str(e),cmd))
31
32 def test_xform_e_mx(self):
33 cmd = 'xform -e -mx'.split() + [ts.datafile('xform_2.dat')]
34 result = self._runit(cmd)
35 expect = lcompare.split_radfile(ts.datafile('xform_res2.dat'))
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 :