summaryrefslogtreecommitdiff
path: root/weave/tests/test_standard_array_spec.py
diff options
context:
space:
mode:
authorEric Jones <eric@enthought.com>2002-01-03 19:50:46 +0000
committerEric Jones <eric@enthought.com>2002-01-03 19:50:46 +0000
commit6e13c0408681ef82fc5f70d002d34993f19cc659 (patch)
treefbaba261253d70c119dcdbf343dbfccb84fbcad1 /weave/tests/test_standard_array_spec.py
parent7161eb8ef2587dea3e8066bf209d0fe715057d0c (diff)
downloadnumpy-6e13c0408681ef82fc5f70d002d34993f19cc659.tar.gz
renaming compiler to weave
Diffstat (limited to 'weave/tests/test_standard_array_spec.py')
-rw-r--r--weave/tests/test_standard_array_spec.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/weave/tests/test_standard_array_spec.py b/weave/tests/test_standard_array_spec.py
new file mode 100644
index 000000000..be3bcc0ea
--- /dev/null
+++ b/weave/tests/test_standard_array_spec.py
@@ -0,0 +1,62 @@
+import unittest
+from Numeric import *
+from fastumath import *
+import RandomArray
+import time
+
+from scipy_distutils.misc_util import add_grandparent_to_path, restore_path
+
+add_grandparent_to_path(__name__)
+import standard_array_spec
+restore_path()
+
+def remove_whitespace(in_str):
+ import string
+ out = string.replace(in_str," ","")
+ out = string.replace(out,"\t","")
+ out = string.replace(out,"\n","")
+ return out
+
+def print_assert_equal(test_string,actual,desired):
+ """this should probably be in scipy.scipy_test
+ """
+ import pprint
+ try:
+ assert(actual == desired)
+ except AssertionError:
+ import cStringIO
+ msg = cStringIO.StringIO()
+ msg.write(test_string)
+ msg.write(' failed\nACTUAL: \n')
+ pprint.pprint(actual,msg)
+ msg.write('DESIRED: \n')
+ pprint.pprint(desired,msg)
+ raise AssertionError, msg.getvalue()
+
+class test_array_specification(unittest.TestCase):
+ def check_type_match_string(self):
+ s = standard_array_spec.array_specification()
+ assert( not s.type_match('string') )
+ def check_type_match_int(self):
+ s = standard_array_spec.array_specification()
+ assert(not s.type_match(5))
+ def check_type_match_array(self):
+ s = standard_array_spec.array_specification()
+ assert(s.type_match(arange(4)))
+
+def test_suite():
+ suites = []
+
+ suites.append( unittest.makeSuite(test_array_specification,'check_'))
+
+ total_suite = unittest.TestSuite(suites)
+ return total_suite
+
+def test():
+ all_tests = test_suite()
+ runner = unittest.TextTestRunner()
+ runner.run(all_tests)
+ return runner
+
+if __name__ == "__main__":
+ test()