mailr27123 - /trunk/test_suite/unit_tests/_lib/test_io.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on December 18, 2014 - 10:33:
Author: bugman
Date: Thu Dec 18 10:33:09 2014
New Revision: 27123

URL: http://svn.gna.org/viewcvs/relax?rev=27123&view=rev
Log:
Created 4 unit tests for the lib.io.swap_extension function.

This is in preparation for implementing the function.


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=27123&r1=27122&r2=27123&view=diff
==============================================================================
--- trunk/test_suite/unit_tests/_lib/test_io.py (original)
+++ trunk/test_suite/unit_tests/_lib/test_io.py Thu Dec 18 10:33:09 2014
@@ -96,3 +96,35 @@
         # Check that nothing changes.
         self.assertNotEqual(lib.io.get_file_path(file1), file1)
         self.assertNotEqual(lib.io.get_file_path(file2), file2)
+
+
+    def test_swap_extension_no_ext(self):
+        """Test the lib.io.swap_extension function with a file with no 
extension."""
+
+        # Check for a file name with no extension.
+        file_name = lib.io.swap_extension('test', 'txt')
+        self.assertEqual(file_name, 'test.txt')
+
+
+    def test_swap_extension_ext(self):
+        """Test the lib.io.swap_extension function with a file with an 
extension."""
+
+        # Check for a file name with no extension.
+        file_name = lib.io.swap_extension('test.txt', 'png')
+        self.assertEqual(file_name, 'test.png')
+
+
+    def test_swap_extension_double_ext(self):
+        """Test the lib.io.swap_extension function with a file with a double 
extension."""
+
+        # Check for a file name with no extension.
+        file_name = lib.io.swap_extension('test.txt.gz', 'png')
+        self.assertEqual(file_name, 'test.png')
+
+
+    def test_swap_extension_broken_ext(self):
+        """Test the lib.io.swap_extension function with a file with a broken 
extension."""
+
+        # Check for a file name with no extension.
+        file_name = lib.io.swap_extension('test.', 'png')
+        self.assertEqual(file_name, 'test.png')




Related Messages


Powered by MHonArc, Updated Thu Dec 18 10:40:04 2014