예제 #1
0
def test_circuitpython_mode_no_charts():
    """
    If QCharts is not available, ensure the plotter feature is not available.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    am = CircuitPythonMode(editor, view)
    with mock.patch("mu.modes.circuitpython.CHARTS", False):
        actions = am.actions()
        assert len(actions) == 1
        assert actions[0]["name"] == "serial"
        assert actions[0]["handler"] == am.toggle_repl
예제 #2
0
def test_circuitpython_mode():
    """
    Sanity check for setting up the mode.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    am = CircuitPythonMode(editor, view)
    assert am.name == 'CircuitPython'
    assert am.description is not None
    assert am.icon == 'circuitpython'
    assert am.editor == editor
    assert am.view == view

    actions = am.actions()
    assert len(actions) == 2
    assert actions[0]['name'] == 'serial'
    assert actions[0]['handler'] == am.toggle_repl
    assert actions[1]['name'] == 'plotter'
    assert actions[1]['handler'] == am.toggle_plotter
    assert 'code' not in am.module_names
예제 #3
0
def test_circuitpython_mode():
    """
    Sanity check for setting up the mode.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    am = CircuitPythonMode(editor, view)
    assert am.name == "CircuitPython"
    assert am.description is not None
    assert am.icon == "circuitpython"
    assert am.editor == editor
    assert am.view == view

    actions = am.actions()
    assert len(actions) == 2
    assert actions[0]["name"] == "serial"
    assert actions[0]["handler"] == am.toggle_repl
    assert actions[1]["name"] == "plotter"
    assert actions[1]["handler"] == am.toggle_plotter
    assert "code" not in am.module_names