mailr3596 - /1.3/test_suite/unit_tests/prompt/test_spin.py


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

Header


Content

Posted by edward on November 18, 2007 - 23:08:
Author: bugman
Date: Sun Nov 18 23:08:09 2007
New Revision: 3596

URL: http://svn.gna.org/viewcvs/relax?rev=3596&view=rev
Log:
Wrote a function for returning all different types of data as an array.

This data will be used to test the proper behaviour of the user functions to 
the handling of their
arguments.


Modified:
    1.3/test_suite/unit_tests/prompt/test_spin.py

Modified: 1.3/test_suite/unit_tests/prompt/test_spin.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/prompt/test_spin.py?rev=3596&r1=3595&r2=3596&view=diff
==============================================================================
--- 1.3/test_suite/unit_tests/prompt/test_spin.py (original)
+++ 1.3/test_suite/unit_tests/prompt/test_spin.py Sun Nov 18 23:08:09 2007
@@ -39,6 +39,14 @@
 relax.interpreter = Container()
 relax.interpreter.intro = True
 
+# A dummy function for testing data types.
+def dummy_fn():
+    pass
+
+# A second dummy function for testing data types.
+def dummy_fn2():
+    return "Hello"
+
 
 class Test_spin(Spin_base_class, TestCase):
     """Unit tests for the functions of the 'generic_fns.spin' module."""
@@ -47,3 +55,59 @@
     spin_fns = Spin(relax)
 
 
+    def return_data_types(self):
+        """Function for returning an array of many different Python objects.
+        
+        These objects are to test the correct behaviour towards the user 
function arguments.
+        """
+
+        # Create the array.
+        data_types = []
+
+        # None.
+        data_types.append(['None', None])
+
+        # Integers.
+        data_types.append(['int', 0])
+        data_types.append(['int', 10])
+        data_types.append(['int', -10])
+
+        # Binaries.
+        data_types.append(['bin', 0])
+        data_types.append(['bin', 1])
+
+        # Floats.
+        data_types.append(['float', 0.0])
+        data_types.append(['float', 1e-7])
+        data_types.append(['float', 1000000.0])
+
+        # Functions.
+        data_types.append(['function', dummy_fn])
+        data_types.append(['function', dummy_fn2])
+
+        # Strings.
+        data_types.append(['str', 'a'])
+        data_types.append(['str', '10'])
+
+        # List.
+        data_types.append(['list', []])
+        data_types.append(['list', [None, None]])
+
+        # List of integers.
+        data_types.append(['int list', [-1, 0, 1]])
+
+        # List of floats.
+        data_types.append(['float list', [-1., 0., 1.]])
+
+        # List of numbers.
+        data_types.append(['number list', [-1., 0, 1.]])
+
+        # List of strings.
+        data_types.append(['str list', ['a']])
+        data_types.append(['str list', ['a', 'asldfjk']])
+
+        # Tuple.
+        data_types.append(['tuple', (None, None)])
+
+        # Return the data type array.
+        return data_types




Related Messages


Powered by MHonArc, Updated Sun Nov 18 23:20:09 2007