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