def test_test_component_inputs_failure(self): "test_component_inputs should return false if an unmet input requirement exists" the_input = Component() the_input.state.set_flag('BAR') requirement = lambda x: 'FOO' in x.state.flags subject = Component() self.assertIsInstance(the_input, Component) subject.plug_out_from(the_input) subject.register_component(the_input) self.assertFalse(req.test_component_inputs(the_input, requirement))
def test_test_component_outputs_pass(self): """test_component_outputs should return True if all output requirements are met""" requirement = lambda component : 'IS_FOO' in component.state.flags subject = Component() the_output = Component() the_output.state.set_flag('IS_FOO') subject.register_component(the_output) the_output.plug_out_from(subject) self.assertEqual(len(subject.item_outputs()), 1) self.assertEqual(req.test_component_outputs(subject, requirement), True)