From: W. Trevor King Date: Tue, 17 Aug 2010 10:29:34 +0000 (-0400) Subject: Broke config section of test/tutorial.py out into test/config.py X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=540a183bbac5399c3cc6acbcc685fa4ba10ef3c3;p=hooke.git Broke config section of test/tutorial.py out into test/config.py --- diff --git a/test/config.py b/test/config.py new file mode 100644 index 0000000..0ef82cb --- /dev/null +++ b/test/config.py @@ -0,0 +1,60 @@ +# 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 +# . + +""" +Test the commands listed in :file:`doc/tutorial.txt`. + +>>> import os +>>> import os.path +>>> from hooke.hooke import Hooke, HookeRunner +>>> h = Hooke() +>>> r = HookeRunner() +>>> h = r.run_lines(h, ['set_config conditions temperature 300.0']) +Success + +>>> h = r.run_lines(h, ['get_config conditions temperature']) +300.0 +Success + +>>> h = r.run_lines(h, ['set_config conditions temperature 295.3']) +Success + +>>> h = r.run_lines(h, ['get_config conditions temperature']) +295.3 +Success + +>>> h = r.run_lines(h, ['print_config']) # doctest: +ELLIPSIS +# Default environmental conditions in case they are not specified in +# the force curve data. Configuration options in this section are +# available to every plugin. +[conditions] +# Temperature in Kelvin +temperature = 295.3 + +... +>>> config_already_exists = os.path.exists('myconfig.cfg') +>>> config_already_exists +False +>>> h = r.run_lines(h, ['save_config --output myconfig.cfg']) +Success + +>>> os.path.isfile('myconfig.cfg') +True +>>> if config_already_exists == False: +... os.remove('myconfig.cfg') +""" diff --git a/test/tutorial.py b/test/tutorial.py index 967cda8..d352697 100644 --- a/test/tutorial.py +++ b/test/tutorial.py @@ -249,30 +249,5 @@ Success *Configuring Hooke* ->>> h = r.run_lines(h, ['set_config conditions temperature 300.0']) -Success - ->>> h = r.run_lines(h, ['get_config conditions temperature']) -300.0 -Success - ->>> h = r.run_lines(h, ['set_config conditions temperature 295.3']) -Success - ->>> h = r.run_lines(h, ['get_config conditions temperature']) -295.3 -Success - ->>> h = r.run_lines(h, ['print_config']) # doctest: +ELLIPSIS -# Default environmental conditions in case they are not specified in -# the force curve data. Configuration options in this section are -# available to every plugin. -[conditions] -# Temperature in Kelvin -temperature = 295.3 - -... ->>> h = r.run_lines(h, ['save_config']) -Success - +See :file:`config.py`. """