Author: bugman Date: Tue Jun 10 10:08:33 2014 New Revision: 23780 URL: http://svn.gna.org/viewcvs/relax?rev=23780&view=rev Log: Created two unit tests for the lib.io.file_root() function. The second of the tests demonstrate a failure of the function if multiple file extensions are present. Modified: trunk/test_suite/unit_tests/_lib/test_io.py Modified: trunk/test_suite/unit_tests/_lib/test_io.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/unit_tests/_lib/test_io.py?rev=23780&r1=23779&r2=23780&view=diff ============================================================================== --- trunk/test_suite/unit_tests/_lib/test_io.py (original) +++ trunk/test_suite/unit_tests/_lib/test_io.py Tue Jun 10 10:08:33 2014 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2007-2013 Edward d'Auvergne # +# Copyright (C) 2007-2014 Edward d'Auvergne # # # # This file is part of the program relax (http://www.nmr-relax.com). # # # @@ -29,6 +29,28 @@ class Test_io(TestCase): """Unit tests for the functions of the 'lib.io' module.""" + + + def test_file_root(self): + """Test the lib.io.file_root() function with '/tmp/test.xyz'.""" + + # The data. + file = '/tmp/test.xyz' + root = 'test' + + # Check the function. + self.assertEqual(lib.io.file_root(file), root) + + + def test_file_root2(self): + """Test the lib.io.file_root() function with '/tmp/test.xyz.gz'.""" + + # The data. + file = '/tmp/test.xyz.gz' + root = 'test' + + # Check the function. + self.assertEqual(lib.io.file_root(file), root) def test_get_file_path(self):