def test_read_sensors(self, epm): mcp1 = epm.devcfg.devices['MCP1'] mcp2 = epm.devcfg.devices['MCP2'] mcp1.input = Mock(return_value=False) mcp2.input = Mock(return_value=True) results = epm.read_sensors() mcp1.assert_has_calls([call.input(1)]) mcp2.assert_has_calls([call.input(2)]) assert results == {'Open Arm|-9': InputPin(device=mcp1, pin=1)}
def test_input_values_true(self, dc): dc.initialize() mcp1 = dc.devices['MCP1'] mcp2 = dc.devices['MCP2'] mcp1.input = Mock(return_value=True) mcp2.input = Mock(return_value=False) results = dc.input_values() mcp1.assert_has_calls([call.input(1)]) mcp2.assert_has_calls([call.input(2), call.input(3)]) assert results == {'Open Arm|-9': InputPin(device=mcp1, pin=1)}
def test_test_start_triggered(self, epm): mcp1 = epm.devcfg.devices['MCP1'] mcp1.input = Mock(return_value=True) assert epm.test_start_triggered() == False mcp1.input = Mock(return_value=False) assert epm.test_start_triggered() == True assert mcp1.mock_calls == [ call.setup(1, 1), call.pullup(1, True), call.input(1), call.input(1) ]
def test_detect_test_start_blocks(self, epm): mcp1 = epm.devcfg.devices['MCP1'] mcp1.input = Mock(return_value=True) SignalAfterDelay( mcp1).start() # sets mcp1.input = Mock(return_value = False) epm.detect_test_start() assert mcp1.mock_calls.count(call.input(1)) > 3