From: W. Trevor King Date: Wed, 11 Aug 2010 17:37:29 +0000 (-0400) Subject: Add test/export_block.py X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=02f14c5e6debb9d9abcaec839eca92e598ff611e;p=hooke.git Add test/export_block.py --- diff --git a/test/export_block.py b/test/export_block.py new file mode 100644 index 0000000..15a01ed --- /dev/null +++ b/test/export_block.py @@ -0,0 +1,46 @@ +# Copyright (C) 2010 W. Trevor King +# +# This file is part of Hooke. +# +# Hooke is free software: you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Hooke is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General +# Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with Hooke. If not, see +# . + +""" +>>> import os +>>> import os.path +>>> from uuid import uuid4 +>>> from hooke.hooke import Hooke, HookeRunner + +>>> h = Hooke() +>>> r = HookeRunner() +>>> h = r.run_lines(h, ['load_playlist test/data/test']) # doctest: +ELLIPSIS + +Success + +>>> file_name = '%s.dat' % uuid4() +>>> h = r.run_lines(h, ['export_block --output %s' % file_name]) +Success + +>>> with open(file_name, 'r') as f: +... lines = f.readlines() +>>> os.remove(file_name) +>>> print len(lines) +2049 +>>> print ''.join(lines[:5]), # doctest: +ELLIPSIS, +REPORT_UDIFF +NORMALIZE_WHITESPACE +# z piezo (m) deflection (m) +-1.519...e-07 9.094...e-08 +-1.513...e-07 9.130...e-08 +-1.513...e-07 9.157...e-08 +-1.507...e-07 9.189...e-08 +"""