本文整理汇总了Python中py65.monitor.Monitor.do_save方法的典型用法代码示例。如果您正苦于以下问题:Python Monitor.do_save方法的具体用法?Python Monitor.do_save怎么用?Python Monitor.do_save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类py65.monitor.Monitor
的用法示例。
在下文中一共展示了Monitor.do_save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_save
# 需要导入模块: from py65.monitor import Monitor [as 别名]
# 或者: from py65.monitor.Monitor import do_save [as 别名]
def test_save(self):
stdout = StringIO()
mon = Monitor(stdout=stdout)
mon._mpu.memory[0:3] = [0xAA, 0xBB, 0xCC]
f = tempfile.NamedTemporaryFile()
mon.do_save("'%s' 0 2" % f.name)
f.seek(0)
self.assertEqual(chr(0xAA) + chr(0xBB) + chr(0xCC),
f.read())
self.assertEqual('Saved +3 bytes to %s\n' % f.name,
stdout.getvalue())
f.close()
示例2: test_save
# 需要导入模块: from py65.monitor import Monitor [as 别名]
# 或者: from py65.monitor.Monitor import do_save [as 别名]
def test_save(self):
stdout = StringIO()
mon = Monitor(stdout=stdout)
mon._mpu.memory[0:3] = [0xAA, 0xBB, 0xCC]
filename = tempfile.mktemp()
try:
mon.do_save("'%s' 0 2" % filename)
self.assertEqual("Saved +3 bytes to %s\n" % filename, stdout.getvalue())
f = open(filename, "rb")
contents = f.read()
f.close()
self.assertEqual(b"\xaa\xbb\xcc", contents)
finally:
os.unlink(filename)
示例3: test_save_with_less_than_three_args_syntax_error
# 需要导入模块: from py65.monitor import Monitor [as 别名]
# 或者: from py65.monitor.Monitor import do_save [as 别名]
def test_save_with_less_than_three_args_syntax_error(self):
stdout = StringIO()
mon = Monitor(stdout=stdout)
mon.do_save('filename start')
out = stdout.getvalue()
self.assertTrue(out.startswith('Syntax error'))