Author: bugman Date: Wed Nov 21 00:05:14 2007 New Revision: 3740 URL: http://svn.gna.org/viewcvs/relax?rev=3740&view=rev Log: Implemented the file arg unit test for the state.load() user function. Modified: 1.3/test_suite/unit_tests/_prompt/test_state.py Modified: 1.3/test_suite/unit_tests/_prompt/test_state.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_prompt/test_state.py?rev=3740&r1=3739&r2=3740&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_prompt/test_state.py (original) +++ 1.3/test_suite/unit_tests/_prompt/test_state.py Wed Nov 21 00:05:14 2007 @@ -22,12 +22,47 @@ # Python module imports. from unittest import TestCase +import sys # relax module imports. from test_suite.unit_tests.state_testing_base import State_base_class +from data_types import return_data_types +from prompt.state import State +from relax_errors import RelaxStrError + + +# Set the variable sys.ps3 (this is required by the user functions). +sys.ps3 = 'relax> ' + + +# A class to act as a container. +class Container: + pass + +# Fake normal relax usage of the user function class. +relax = Container() +relax.interpreter = Container() +relax.interpreter.intro = True + +# Instantiate the user function class. +state = State(relax) + + +class Test_state(State_base_class, TestCase): + """Unit tests for the functions of the 'prompt.state' module.""" + + + def test_load_argfail_file(self): + """Test the proper failure of the state.load() user function for the file argument.""" + + # Loop over the data types. + for data in return_data_types(): + # Catch the str arguments, and skip them. + if data[0] == 'str': + continue + + # The argument test. + self.assertRaises(RelaxStrError, state.load, file=data[1]) -class Test_state(State_base_class, TestCase): - """Unit tests for the functions of the 'prompt.state' module.""" -