Back to index

radiance  4R0+20100331
test_xform.py
Go to the documentation of this file.
00001 
00002 import os
00003 import math
00004 import string
00005 import unittest
00006 
00007 from unit_tools import support
00008 from unit_tools import lcompare
00009 
00010 class XformTestCase(unittest.TestCase):
00011        def setUp(self):
00012               self.oldpath = os.environ['PATH']
00013               os.environ['PATH'] = os.path.abspath(support.BINDIR)
00014 
00015        def tearDown(self):
00016               os.environ['PATH'] = self.oldpath
00017               
00018        def test_xform(self):
00019               cmd = 'xform -e -s 3.14159 "%s"' % support.datafile('xform_1.dat')
00020               result = lcompare.split_rad(os.popen(cmd).read())
00021               expect = lcompare.split_radfile(support.datafile('xform_res1.dat'))
00022               try: lcompare.llcompare(result, expect, ignore_empty=1)
00023               except lcompare.error, e:
00024                      self.fail('%s [%s]' % (str(e),cmd))
00025 
00026 
00027        def test_xform(self):
00028               cmd = 'xform -e -mx "%s"' % support.datafile('xform_2.dat')
00029               result = lcompare.split_rad(os.popen(cmd).read())
00030               expect = lcompare.split_radfile(support.datafile('xform_res2.dat'))
00031               try: lcompare.llcompare(result, expect, ignore_empty=1)
00032               except lcompare.error, e:
00033                      self.fail('%s [%s]' % (str(e),cmd))
00034 
00035 def main():
00036        support.run_case(XformTestCase)
00037 
00038 if __name__ == '__main__':
00039        main()
00040 
00041 # vi: set ts=4 sw=4 :