Back to index

radiance  4R0+20100331
Public Member Functions | Public Attributes
py_tests.test_histo.HistoTestCase Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def test_histo
def test_histo_c
def test_histo_p
def test_histo_pc

Public Attributes

 oldpath

Detailed Description

Definition at line 9 of file test_histo.py.


Member Function Documentation

Definition at line 10 of file test_histo.py.

00010 
00011        def setUp(self):
00012               self.oldpath = os.environ['PATH']
00013               os.environ['PATH'] = os.path.abspath(support.BINDIR)

Definition at line 14 of file test_histo.py.

00014 
00015        def tearDown(self):
00016               os.environ['PATH'] = self.oldpath

Definition at line 17 of file test_histo.py.

00017 
00018        def test_histo(self):
00019               cmd = 'histo -0.5 8.5 9 < "%s"' % support.datafile('histo.dat')
00020               raw = os.popen(cmd).read()
00021               result = map(string.split,string.split(raw,'\n'))
00022               expect = [
00023                      [0, 720, 240, 432, 1080, 270],
00024                      [1, 720, 240, 432, 1080, 270],
00025                      [2, 720, 240, 432,    0, 270],
00026                      [3,   0, 240, 432,    0, 270],
00027                      [4,   0, 240, 432,    0, 270],
00028                      [5,   0, 240,   0,    0, 270],
00029                      [6,   0, 240,   0,    0, 270],
00030                      [7,   0, 240,   0,    0, 270],
00031                      [8,   0, 240,   0,    0,   0],
00032               ]
00033               try: lcompare.llcompare(result, expect, ignore_empty=1)
00034               except lcompare.error, e:
00035                      self.fail('%s [%s]' % (str(e),cmd))

Definition at line 36 of file test_histo.py.

00036 
00037        def test_histo_c(self):
00038               cmd = 'histo -c -0.5 8.5 9 < "%s"' % support.datafile('histo.dat')
00039               raw = os.popen(cmd).read()
00040               result = map(string.split,string.split(raw,'\n'))
00041               expect = [
00042                      [-0.5,   0,    0,    0,    0,    0],
00043                      [0.5,  720,  240,  432, 1080,  270],
00044                      [1.5, 1440,  480,  864, 2160,  540],
00045                      [2.5, 2160,  720, 1296, 2160,  810],
00046                      [3.5, 2160,  960, 1728, 2160, 1080],
00047                      [4.5, 2160, 1200, 2160, 2160, 1350],
00048                      [5.5, 2160, 1440, 2160, 2160, 1620],
00049                      [6.5, 2160, 1680, 2160, 2160, 1890],
00050                      [7.5, 2160, 1920, 2160, 2160, 2160],
00051                      [8.5, 2160, 2160, 2160, 2160, 2160],
00052               ]
00053               try: lcompare.llcompare(result, expect, ignore_empty=1)
00054               except lcompare.error, e:
00055                      self.fail('%s [%s]' % (str(e),cmd))

Definition at line 56 of file test_histo.py.

00056 
00057        def test_histo_p(self):
00058               cmd = 'histo -p -0.5 8.5 9 < "%s"' % support.datafile('histo.dat')
00059               raw = os.popen(cmd).read()
00060               result = map(string.split,string.split(raw,'\n'))
00061               expect = [
00062                      [0, 33.333333, 11.111111, 20.0, 50.0, 12.5],
00063                      [1, 33.333333, 11.111111, 20.0, 50.0, 12.5],
00064                      [2, 33.333333, 11.111111, 20.0,  0.0, 12.5],
00065                      [3,       0.0, 11.111111, 20.0,  0.0, 12.5],
00066                      [4,       0.0, 11.111111, 20.0,  0.0, 12.5],
00067                      [5,       0.0, 11.111111,  0.0,  0.0, 12.5],
00068                      [6,       0.0, 11.111111,  0.0,  0.0, 12.5],
00069                      [7,       0.0, 11.111111,  0.0,  0.0, 12.5],
00070                      [8,       0.0, 11.111111,  0.0,  0.0,  0.0],
00071               ]
00072               try: lcompare.llcompare(result, expect, ignore_empty=1)
00073               except lcompare.error, e:
00074                      self.fail('%s [%s]' % (str(e),cmd))

Definition at line 75 of file test_histo.py.

00075 
00076        def test_histo_pc(self):
00077               cmd = 'histo -p -c -0.5 8.5 9 < "%s"' % support.datafile('histo.dat')
00078               raw = os.popen(cmd).read()
00079               result = map(string.split,string.split(raw,'\n'))
00080               expect = [
00081                      [-0.5,      0.0,       0.0,   0.0,   0.0,   0.0],
00082                      [0.5, 33.333333, 11.111111,  20.0,  50.0,  12.5],
00083                      [1.5, 66.666667, 22.222222,  40.0, 100.0,  25.0],
00084                      [2.5,     100.0, 33.333333,  60.0, 100.0,  37.5],
00085                      [3.5,     100.0, 44.444444,  80.0, 100.0,  50.0],
00086                      [4.5,     100.0, 55.555556, 100.0, 100.0,  62.5],
00087                      [5.5,     100.0, 66.666667, 100.0, 100.0,  75.0],
00088                      [6.5,     100.0, 77.777778, 100.0, 100.0,  87.5],
00089                      [7.5,     100.0, 88.888889, 100.0, 100.0, 100.0],
00090                      [8.5,     100.0,     100.0, 100.0, 100.0, 100.0],
00091               ]
00092               try: lcompare.llcompare(result, expect, ignore_empty=1)
00093               except lcompare.error, e:
00094                      self.fail('%s [%s]' % (str(e),cmd))


Member Data Documentation

Definition at line 11 of file test_histo.py.


The documentation for this class was generated from the following file: