__init__.py :  » Math » Modular-toolkit-for-Data-Processing » MDP-2.6 » mdp » test » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Math » Modular toolkit for Data Processing 
Modular toolkit for Data Processing » MDP 2.6 » mdp » test » __init__.py
"""This is the test module for MDP.

Run all tests with:
>>> import mdp
>>> mdp.test()

"""

import unittest
import sys
import mdp

import test_nodes
import test_flows
import test_utils
import test_graph
import test_contrib
import test_extension
import test_hinet
import test_schedule
import test_parallelnodes
import test_parallelflows
import test_parallelhinet
import test_process_schedule
import test_classifier

numx = mdp.numx
numx_rand = mdp.numx_rand

_err_str = """\nIMPORTANT: some tests use random numbers. This could
occasionally lead to failures due to numerical degeneracies.
To rule this out, please run the tests more than once.
If you get reproducible failures please report a bug!
"""

test_suites = {'flows': (test_flows.get_suite, 0),
               'utils': (test_utils.get_suite, 1),
               'graph': (test_graph.get_suite, 2),
               'nodes': (test_nodes.get_suite, 3),
               'extension': (test_extension.get_suite, 4),
               'hinet':   (test_hinet.get_suite, 5),
               'schedule': (test_schedule.get_suite, 6),
               'parallelnodes': (test_parallelnodes.get_suite, 7),
               'parallelflows': (test_parallelflows.get_suite, 8),
               'parallelhinet': (test_parallelhinet.get_suite, 9),
               'process_schedule': (test_process_schedule.get_suite, 10),
               'contrib': (test_contrib.get_suite, 11),
               'classifier': (test_classifier.get_suite, 12)}
                           

def test(suitename = 'all', verbosity = 2, seed = None, testname = None):
    if seed is None:
        seed = int(numx_rand.randint(2**31-1))

    numx_rand.seed(seed)
    mdp.info()
    sys.stderr.write("\nRandom Seed: " + str(seed)+'\n')
    if suitename == 'all':
        sorted_suites = [x[0](testname=testname)
                         for x in sorted(test_suites.values(),
                                         key=lambda y: y[1])]
        suite = unittest.TestSuite(sorted_suites)
    else:
        suite = test_suites[suitename][0](testname=testname)
    res = unittest.TextTestRunner(verbosity=verbosity).run(suite)
    if len(res.errors+res.failures) > 0:
        sys.stderr.write(_err_str)
    mdp.info()
    sys.stderr.write("\nRandom Seed was: " + str(seed)+'\n')
    
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.