def setUpClass(cls) -> None: """Use the ``LoadPlasticcCadence`` node to load data into a mock pipeline""" # Create a mock pipeline cadence = PLAsTICC('alt_sched', 11) load_action = LoadPlasticcCadence(cadence, num_processes=0) mock_target = MockTarget() # Execute the pipeline load_action.output.connect(mock_target.input) load_action.execute() mock_target.execute() # pipeline results cls.packet = mock_target.accumulated_data[0] # manually loaded results cls.snid, cls.params, cls.cadence = next( cadence.iter_cadence(iter_lim=1, verbose=False))
def runTest(self) -> None: # Create one node to output data and two to accept it test_data = [1, 2, 3] source = MockSource(test_data) target_a = MockTarget() target_b = MockTarget() # Connect two outputs to the same input source.output.connect(target_a.input) source.output.connect(target_b.input) source.execute() sleep(1) # Give the queue a chance to update # Both inputs should have received the same data from the output target_a.execute() self.assertListEqual(test_data, target_a.accumulated_data) target_b.execute() self.assertListEqual(test_data, target_b.accumulated_data)