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 : |