本文整理汇总了Python中mu.modes.microbit.MicrobitMode.get_hex_path方法的典型用法代码示例。如果您正苦于以下问题:Python MicrobitMode.get_hex_path方法的具体用法?Python MicrobitMode.get_hex_path怎么用?Python MicrobitMode.get_hex_path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mu.modes.microbit.MicrobitMode
的用法示例。
在下文中一共展示了MicrobitMode.get_hex_path方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_custom_hex_read
# 需要导入模块: from mu.modes.microbit import MicrobitMode [as 别名]
# 或者: from mu.modes.microbit.MicrobitMode import get_hex_path [as 别名]
def test_custom_hex_read():
"""
Test that a custom hex file path can be read
"""
editor = mock.MagicMock()
view = mock.MagicMock()
mm = MicrobitMode(editor, view)
with mock.patch('mu.modes.microbit.get_settings_path',
return_value='tests/settingswithcustomhex.json'), \
mock.patch('mu.modes.microbit.os.path.exists', return_value=True),\
mock.patch('mu.modes.base.BaseMode.workspace_dir',
return_value=TEST_ROOT):
assert "customhextest.hex" in mm.get_hex_path()
"""
Test that a corrupt settings file returns None for the
runtime hex path
"""
with mock.patch('mu.modes.microbit.get_settings_path',
return_value='tests/settingscorrupt.json'), \
mock.patch('mu.modes.base.BaseMode.workspace_dir',
return_value=TEST_ROOT):
assert mm.get_hex_path() is None
"""
Test that a missing settings file returns None for the
runtime hex path
"""
with mock.patch('mu.modes.microbit.get_settings_path',
return_value='tests/settingswithmissingcustomhex.json'), \
mock.patch('mu.modes.base.BaseMode.workspace_dir',
return_value=TEST_ROOT):
assert mm.get_hex_path() is None