def test_exception_in_handle_data(self): algo = ExceptionAlgorithm('handle_data', self.sid, sim_params=self.sim_params, env=self.env) with self.assertRaises(Exception) as ctx: algo.run(self.data_portal) self.assertEqual(str(ctx.exception), 'Algo exception in handle_data')
def test_exception_in_handle_data(self): # Simulation # ---------- self.zipline_test_config['algorithm'] = \ ExceptionAlgorithm( 'handle_data', self.zipline_test_config['sid'] ) zipline = simfactory.create_test_zipline(**self.zipline_test_config) with self.assertRaises(Exception) as ctx: output, _ = drain_zipline(self, zipline) self.assertEqual(ctx.exception.message, 'Algo exception in handle_data')
def test_exception_in_handle_data(self): # Simulation # ---------- self.zipline_test_config['algorithm'] = \ ExceptionAlgorithm( 'handle_data', self.zipline_test_config['sid'], sim_params=factory.create_simulation_parameters(), env=self.env ) zipline = simfactory.create_test_zipline(**self.zipline_test_config) with self.assertRaises(Exception) as ctx: output, _ = drain_zipline(self, zipline) self.assertEqual(str(ctx.exception), 'Algo exception in handle_data')