本文整理汇总了Python中py._code.code.FormattedExcinfo.repr_locals方法的典型用法代码示例。如果您正苦于以下问题:Python FormattedExcinfo.repr_locals方法的具体用法?Python FormattedExcinfo.repr_locals怎么用?Python FormattedExcinfo.repr_locals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类py._code.code.FormattedExcinfo
的用法示例。
在下文中一共展示了FormattedExcinfo.repr_locals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_repr_local
# 需要导入模块: from py._code.code import FormattedExcinfo [as 别名]
# 或者: from py._code.code.FormattedExcinfo import repr_locals [as 别名]
def test_repr_local(self):
p = FormattedExcinfo(showlocals=True)
loc = {'y': 5, 'z': 7, 'x': 3, '@x': 2, '__builtins__': {}}
reprlocals = p.repr_locals(loc)
assert reprlocals.lines
assert reprlocals.lines[0] == '__builtins__ = <builtins>'
assert reprlocals.lines[1] == 'x = 3'
assert reprlocals.lines[2] == 'y = 5'
assert reprlocals.lines[3] == 'z = 7'