test_bin.py
来自「minimal python variant for small footpri」· Python 代码 · 共 47 行
PY
47 行
#! /usr/bin/env python"""Test script for the binascii C module Uses the mechanism of the python binhex module Roger E. Masse"""import binheximport tempfilefrom test_support import verbosedef test(): try: fname1 = tempfile.mktemp() fname2 = tempfile.mktemp() f = open(fname1, 'w') except: raise ImportError, "Cannot test binascii without a temp file" start = 'Jack is my hero' f.write(start) f.close() binhex.binhex(fname1, fname2) if verbose: print 'binhex' binhex.hexbin(fname2, fname1) if verbose: print 'hexbin' f = open(fname1, 'r') finish = f.readline() if start <> finish: print 'Error: binhex <> hexbin' elif verbose: print 'binhex == hexbin' try: import os os.unlink(fname1) os.unlink(fname2) except: passtest()
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?