| 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 |
schorsch |
1.2 |
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 |
| 39 |
|
|
|
| 40 |
|
|
''' % picfile |
| 41 |
schorsch |
1.1 |
expect = lcompare.split_headers(exps) |
| 42 |
|
|
try: lcompare.llcompare(result, expect, ignore_empty=1) |
| 43 |
|
|
except lcompare.error as e: |
| 44 |
|
|
self.fail('%s [%s]' % (str(e),cmd)) |
| 45 |
|
|
|
| 46 |
|
|
def test_getinfo_d(self): |
| 47 |
|
|
picfile = ts.datafile('Earth128.pic') |
| 48 |
|
|
cmd = ['getinfo', '-d', picfile] |
| 49 |
|
|
result = self._runit(cmd) |
| 50 |
schorsch |
1.2 |
exps = '''%s: -Y 128 +X 128\n''' % picfile |
| 51 |
schorsch |
1.1 |
expect = lcompare.split_headers(exps) |
| 52 |
|
|
try: lcompare.llcompare(result, expect, ignore_empty=1) |
| 53 |
|
|
except lcompare.error as e: |
| 54 |
|
|
self.fail('%s [%s]' % (str(e),cmd)) |
| 55 |
|
|
|
| 56 |
|
|
|
| 57 |
|
|
# vi: set ts=4 sw=4 : |