Author: bugman Date: Fri Jun 1 09:04:05 2012 New Revision: 16580 URL: http://svn.gna.org/viewcvs/relax?rev=16580&view=rev Log: Created two unit tests for the _build_doc() methods of the prompt user function objects. This is for the prompt uf class objects and the user function objects themselves. The _build_doc() methods are used to generate the prompt help strings. Added: branches/uf_redesign/test_suite/unit_tests/_prompt/test_uf_objects.py Added: branches/uf_redesign/test_suite/unit_tests/_prompt/test_uf_objects.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/test_suite/unit_tests/_prompt/test_uf_objects.py?rev=16580&view=auto ============================================================================== --- branches/uf_redesign/test_suite/unit_tests/_prompt/test_uf_objects.py (added) +++ branches/uf_redesign/test_suite/unit_tests/_prompt/test_uf_objects.py Fri Jun 1 09:04:05 2012 @@ -1,0 +1,64 @@ +############################################################################### +# # +# Copyright (C) 2012 Edward d'Auvergne # +# # +# This file is part of the program relax. # +# # +# relax is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# relax 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 General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with relax; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +############################################################################### + +# Module docstring. +"""Unit test module for the prompt.uf_objects module.""" + +# Python module imports. +from unittest import TestCase + +# relax module imports. +from prompt.uf_objects import Class_container, Uf_object +from user_functions.data import Uf_info; uf_info = Uf_info() + + +class Test_uf_objects(TestCase): + """Unit test case for the prompt.uf_objects module.""" + + def test_uf_class_build_doc(self): + """Test the _build_doc() method of all the prompt user function classes.""" + + # Loop over the classes. + for name, data in uf_info.class_loop(): + # Print out. + print(name) + + # Generate a new container. + obj = Class_container(name, data.title) + + # Create the documentation and print it. + text = obj._build_doc() + + + def test_uf_object_build_doc(self): + """Test the _build_doc() method of all the prompt user function objects.""" + + # Loop over the classes. + for name, data in uf_info.uf_loop(): + # Print out. + print(name) + + # Generate a new container. + obj = Uf_object(name, title=data.title, kargs=data.kargs, backend=data.backend, desc=data.desc, examples=data.prompt_examples, additional=data.additional) + + # Create the documentation and print it. + text = obj._build_doc()