~c-e-pidcott/maus/devel

« back to all changes in this revision

Viewing changes to tests/py_unit/test_core_go.py

  • Committer: Chris Rogers
  • Date: 2011-12-22 17:56:36 UTC
  • mfrom: (659.1.5 release-candidate)
  • Revision ID: chris.rogers@stfc.ac.uk-20111222175636-rw9uujiup42a7gnt
Tags: MAUS-v0.1.1
ReleaseĀ 0.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
from ReducePyDoNothing import ReducePyDoNothing
12
12
from OutputPyJSON import OutputPyJSON
13
13
 
14
 
from Go import Go, get_possible_dataflows
 
14
from Go import Go
15
15
 
16
16
class FakeMap(): #pylint: disable = W0232, R0903
17
17
    """Map mock-up that always fails to birth"""
30
30
        """
31
31
        Make sure get_possible_dataflows() doesn't return nonsense
32
32
        """
33
 
        keys = get_possible_dataflows().keys()
 
33
        keys = Go.get_possible_dataflows().keys()
34
34
        self.assertTrue('pipeline_single_thread' in keys)
35
35
 
36
36
    def input_birth_test(self):
109
109
               command_line_args = False)
110
110
 
111
111
 
112
 
    def test_type_of_dataflow_good(self):
113
 
        """Check that Go executes okay with good dataflow"""
 
112
    def test_dataflow_single_thread(self):
 
113
        """
 
114
        Check that Go executes okay with pipeline_single_thread dataflow.
 
115
        """
114
116
        inputer = InputPyEmptyDocument(1)
115
117
        transformer = MapPyDoNothing()
116
118
        merger = ReducePyDoNothing()
121
123
            Go(inputer, transformer, merger, outputer, config, \
122
124
                   command_line_args = False)
123
125
 
 
126
    def test_dataflow_multi_process(self):
 
127
        """
 
128
        Check that Go executes okay with multi_process dataflow.
 
129
        """
 
130
        inputer = InputPyEmptyDocument(1)
 
131
        transformer = MapPyDoNothing()
 
132
        merger = ReducePyDoNothing()
 
133
        outputer = OutputPyJSON(open(self.tmp_file, 'w'))
 
134
        for map_red_type in ['multi_process']:
 
135
            config = StringIO(u"""type_of_dataflow="%s" """ % map_red_type)
 
136
 
 
137
            with self.assertRaises(Exception):
 
138
                Go(inputer, transformer, merger, outputer, config, \
 
139
                       command_line_args = False)
 
140
 
124
141
    def test_dataflow_not_implemented(self):
125
142
        """Check that Go notifies user of unimplemented dataflow"""
126
143
        inputer = InputPyEmptyDocument(1)
127
144
        transformer = MapPyDoNothing()
128
145
        merger = ReducePyDoNothing()
129
146
        outputer = OutputPyJSON(open(self.tmp_file, 'w'))
130
 
        for map_red_type in ['many_local_threads','control_room_style']:
 
147
        for map_red_type in ['many_local_threads']:
131
148
            config = StringIO(u"""type_of_dataflow="%s" """ % map_red_type)
132
149
            
133
150
            with self.assertRaises(NotImplementedError):