Ran update-copyright.py
[hooke.git] / test / tutorial.py
index 967cda8498f57afd472b2e790ff1747b34f02bdd..7dfc865768e987533b397ef1b5267acf5059b04d 100644 (file)
@@ -1,20 +1,19 @@
-# Copyright (C) 2010 W. Trevor King <wking@drexel.edu>
+# Copyright (C) 2010-2012 W. Trevor King <wking@tremily.us>
 #
 # 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 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.
+# 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
-# <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Lesser General Public License
+# along with Hooke.  If not, see <http://www.gnu.org/licenses/>.
 
 """
 Test the commands listed in :file:`doc/tutorial.txt`.
@@ -33,15 +32,15 @@ Documented commands (type help <topic>):
 ========================================
 ...
 >>> h = r.run_lines(h, ['help load_playlist'])
-Command: load_playlist
+Usage: load_playlist [options]
 <BLANKLINE>
-Arguments:
-<BLANKLINE>
-help BOOL (bool) Print a help message.
-output_playlist STRING (string) Name of the new playlist (defaults to
-    an auto-generated name).
-input FILE (file) File name for the input playlist.
-drivers DRIVER (driver) Drivers for loading curves.
+Options:
+  -h, --help            show this help message and exit
+  --disable-stack       Add this command to appropriate command stacks. (True)
+  --output_playlist=OUTPUT_PLAYLIST
+                        Name of the new playlist (defaults to an auto-
+                        generated name). (None)
+  --drivers=DRIVERS     Drivers for loading curves. (None)
 <BLANKLINE>
 Load a playlist.
 <BLANKLINE>
@@ -69,6 +68,7 @@ hooke
 Success
 <BLANKLINE>
 >>> h = r.run_lines(h, ['new_playlist --output_playlist mylist'])
+<FilePlaylist mylist>
 Success
 <BLANKLINE>
 >>> h = r.run_lines(h, ['jump_to_playlist -- -1'])
@@ -94,10 +94,14 @@ False
 >>> h = r.run_lines(h, ['save_playlist --output mylist'])
 Success
 <BLANKLINE>
+>>> h = r.run_lines(h, ['name_playlist my_old_list'])
+<FilePlaylist my_old_list>
+Success
+<BLANKLINE>
 >>> os.path.isfile('mylist.hkp')
 True
 >>> h = r.run_lines(h, ['load_playlist mylist.hkp'])
-<FilePlaylist mylist.hkp>
+<FilePlaylist mylist>
 Success
 <BLANKLINE>
 >>> if playlist_already_exists == False:
@@ -161,22 +165,24 @@ Success
 Success
 <BLANKLINE>
 
+>>> [p for p in h.playlists]
+[<FilePlaylist my_old_list>, <FilePlaylist mylist>]
 >>> h = r.run_lines(h, ['get_playlist'])
-<FilePlaylist mylist>
+<FilePlaylist my_old_list>
 Success
 <BLANKLINE>
 >>> h = r.run_lines(h, ['next_playlist'])
 Success
 <BLANKLINE>
 >>> h = r.run_lines(h, ['get_playlist'])
-<FilePlaylist mylist.hkp>
+<FilePlaylist mylist>
 Success
 <BLANKLINE>
 >>> h = r.run_lines(h, ['previous_playlist'])
 Success
 <BLANKLINE>
 >>> h = r.run_lines(h, ['get_playlist'])
-<FilePlaylist mylist>
+<FilePlaylist my_old_list>
 Success
 <BLANKLINE>
 >>> h = r.run_lines(h, ['playlist_index'])
@@ -187,7 +193,7 @@ Success
 Success
 <BLANKLINE>
 >>> h = r.run_lines(h, ['get_playlist'])
-<FilePlaylist mylist.hkp>
+<FilePlaylist mylist>
 Success
 <BLANKLINE>
 >>> h = r.run_lines(h, ['playlist_index'])
@@ -198,7 +204,7 @@ Success
 Success
 <BLANKLINE>
 >>> h = r.run_lines(h, ['get_playlist'])
-<FilePlaylist mylist>
+<FilePlaylist my_old_list>
 Success
 <BLANKLINE>
 >>> h = r.run_lines(h, ['playlist_index'])
@@ -209,7 +215,7 @@ Success
 Success
 <BLANKLINE>
 >>> h = r.run_lines(h, ['get_playlist'])
-<FilePlaylist mylist.hkp>
+<FilePlaylist mylist>
 Success
 <BLANKLINE>
 >>> h = r.run_lines(h, ['playlist_index'])
@@ -223,56 +229,25 @@ See :file:`note.py`.
 
 *Exporting curves*
 
->>> export_already_exists = os.path.exists('mycurve.dat')
->>> export_already_exists
-False
->>> h = r.run_lines(h, ['export_block --output mycurve.dat'])
-Success
-<BLANKLINE>
->>> os.path.isfile('mycurve.dat')
-True
->>> if export_already_exists == False:
-...    os.remove('mycurve.dat')
+See :file:`export_block.py`.
 
 *Measuring distances and forces*
 
->>> h = r.run_lines(h, ['delta 300 500'])  # doctest: +ELLIPSIS
-[('z piezo (m)', -4.913...e-08), ('deflection (m)', -2.834...e-08)]
-Success
-<BLANKLINE>
+See :file:`delta.py`.
 
 *Worm like chain and freely jointed chain fitting*
 
-*Multiple curve fitting and measuring*
+*Command stacks*
+
+See :file:`command_stack.py`,
+:file:`apply_command_stack_to_playlist.py`, and
+:file:`command_stack_save_load.py`.
 
-*Fast curve reviewing and saving*
+*Multiple curve analysis*
+
+See :file:`multiple_curve_analysis`.
 
 *Configuring Hooke*
 
->>> h = r.run_lines(h, ['set_config conditions temperature 300.0'])
-Success
-<BLANKLINE>
->>> h = r.run_lines(h, ['get_config conditions temperature'])
-300.0
-Success
-<BLANKLINE>
->>> h = r.run_lines(h, ['set_config conditions temperature 295.3'])
-Success
-<BLANKLINE>
->>> h = r.run_lines(h, ['get_config conditions temperature'])
-295.3
-Success
-<BLANKLINE>
->>> 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
-<BLANKLINE>
-...
->>> h = r.run_lines(h, ['save_config'])
-Success
-<BLANKLINE>
+See :file:`config.py`.
 """