Exemplo n.º 1
0
    def test_process_type_without_entry_point(self):
        """
        For a process without a registered entry point, the process_type will fall back on the fully
        qualified class name
        """
        process = test_utils.DummyProcess()
        expected_process_type = '{}.{}'.format(process.__class__.__module__,
                                               process.__class__.__name__)
        self.assertEqual(process.calc.process_type, expected_process_type)

        # Verify that load_process_class on the calculation node returns the original entry point class
        recovered_process = process.calc.load_process_class()
        self.assertEqual(recovered_process, process.__class__)
Exemplo n.º 2
0
    def test_calculation_input(self):
        @work.workfunction
        def simple_wf():
            return {'a': Int(6), 'b': Int(7)}

        outputs, pid = work.launch.run_get_pid(simple_wf)
        calc = load_node(pid)

        dp = test_utils.DummyProcess(inputs={'calc': calc})
        work.launch.run(dp)

        input_calc = dp.calc.get_inputs_dict()['calc']
        self.assertTrue(isinstance(input_calc, FrozenDict))
        self.assertEqual(input_calc['a'], outputs['a'])
Exemplo n.º 3
0
    def test_input_link_creation(self):
        dummy_inputs = ["1", "2", "3", "4"]

        inputs = {l: Int(l) for l in dummy_inputs}
        inputs['store_provenance'] = True
        p = test_utils.DummyProcess(inputs)

        for label, value in p._calc.get_inputs_dict().iteritems():
            self.assertTrue(label in inputs)
            self.assertEqual(int(label), int(value.value))
            dummy_inputs.remove(label)

        # Make sure there are no other inputs
        self.assertFalse(dummy_inputs)
Exemplo n.º 4
0
 def test_save_instance_state(self):
     proc = test_utils.DummyProcess()
     # Save the instance state
     bundle = work.Bundle(proc)
     proc2 = bundle.unbundle()
Exemplo n.º 5
0
 def test_work_calc_finish(self):
     p = test_utils.DummyProcess()
     self.assertFalse(p.calc.is_finished_ok)
     work.launch.run(p)
     self.assertTrue(p.calc.is_finished_ok)
Exemplo n.º 6
0
    def test_label(self):
        dp = test_utils.DummyProcess(inputs={'label': 'My label'})
        self.assertEquals(dp.calc.label, 'My label')

        with self.assertRaises(ValueError):
            test_utils.DummyProcess(inputs={'label': 5})
Exemplo n.º 7
0
    def test_description(self):
        dp = test_utils.DummyProcess(inputs={'description': "Rockin' process"})
        self.assertEquals(dp.calc.description, "Rockin' process")

        with self.assertRaises(ValueError):
            test_utils.DummyProcess(inputs={'description': 5})