#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, os, stat
import argparse
# -b
def isBlockfile(x, y):
stf = os.stat(x)
mode = stf.st_mode
if stat.S_ISBLK(mode):
return 0
else:
return 1
# -c
def isCharspecial(x, y):
stf = os.stat(x)
mode = stf.st_mode
if stat.S_ISCHR(mode):
return 0
else:
return 1
# -d
def isDirectory(x, y):
if os.path.isdir(x):
return 0
else:
return 1
# -e
def isExists(x,y):
if os.path.exists(x):
return 0
else:
return 1
# -f
def isFile(x, y):
if os.path.isfile(x):
return 0
else:
return 1
# -g
def issetGroupID(x, y):
stf = os.stat(x)
mode = stf.st_mode
tmode = stat.S_IMODE(os.lstat(st)[stat.ST_MODE])
if tmode & getattr(stat, "S_ISGID"):
return 0
else:
return 1
# -G
def isownGroupID(x, y):
stf = os.stat(x)
mode = stf.st_mode
groups = os.getgroups()
if stf.st_gid in groups:
return 0
else:
return 1
# -h
# -k
def isStickyBit(x, y):
stf = os.stat(x)
mode = stf.st_mode
kmode = stat.S_IMODE(os.lstat(st)[stat.ST_MODE])
if kmode & getattr(stat, "S_ISVTX"):
return 0
else:
return 1
# -L
def isLink(x, y):
stf = os.stat(x)
mode = stf.st_mode
if stat.S_ISLNK(mode):
return 0
else:
return 1
# -O
def isownUserID(x, y):
stf = os.stat(x)
mode = stf.st_mode
uid = os.stat(st).st_uid
if None != uid:
return 0
else:
return 1
# -p
def isnamePipe(x, y):
# FILE exists and is a named pipe
stf = os.stat(x)
mode = stf.st_mode
if stat.S_ISFIFO(mode):
return 0
else:
return 1
# -r
def isRead(x, y):
if os.access(x, os.R_OK):
return 0
else:
return 1
# -s
# -S
def isSocket(x, y):
# FILE exists and is a socket
stf = os.stat(x)
mode = stf.st_mode
if stat.S_ISSOCK(mode):
return 0
else:
return 1
# -t
# -u
def issetUserID(x, y):
stf = os.stat(x)
mode = stf.st_mode
umode = stat.S_IMODE(os.lstat(st)[stat.ST_MODE])
if umode & getattr(stat, "S_ISUID"):
return 0
else:
return 1
# -w
def isWriter(x, y):
if os.access(x, os.W_OK):
return 0
else:
return 1
# -x
def isExecute(x, y):
if os.access(x, os.X_OK):
return 0
else:
return 1
# -z
def isZero(x, y):
if len(x) = 0:
return 0
else:
return 1
# -n
def isNonZero(x, y):
if len(x) != 0:
return 0
else:
return 1
分享到:
相关推荐
Amber Python Test.zip
//传递参数时,每个参数中间要有一个空格 //Python接收参数的方法: //从1开始接收参数 //args1= sys.argv[1] //args2=sys.argv[2] //args2=sys.argv[3]
PythonTest1
E:\My Documents\Visual Studio Projects\PythonTest\PythonTest.rar
python test 回归函数
test python programming language
Quickly learn how to automate unit testing of ...Chapter 1: Introduction to Python Chapter 2: Getting Started Chapter 3: Unittest Chapter 4: nose and nose2 Chapter 5: pytest Chapter 6: Tips and Tricks
python自动生成Verilog的testbench脚本。python自动生成Verilog的testbench脚本。python自动生成Verilog的testbench脚本。
python test ''' Created on 2011-11-2 @author: ACER ''' import glob, os from testframe.TestSuite import * class PyTestRunner: @staticmethod def run(suite): TestSuite.run(suite) @staticmethod ...
Python Unit Test Automation will allow you to quickly ramp up your understanding of unit test libraries for Python 3 through the practical use of code examples and exercises. All of which makes this ...
pythontest.zip
一个用python写的监控脚本test1.py,用while True方式一直运行,在ssh远程(使用putty终端)时通过以下命令启动脚本: 代码如下: python test1.py & 现在脚本正常运行,通过ps能看到进程号,此时直接关闭ssh终端...
python学习中的笔记源码,可以根据1-8.2的笔记来看,一一对应,希望可以对python初学者有点帮助,有源码有注释
NULL 博文链接:https://love2java.iteye.com/blog/1543204
资源分类:Python库 所属语言:Python 资源全名:test_tube-0.6.7.1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
ps_demo_python_test
PS_python_test.002
Python
python test:一些python安装和人脸识别的东西。python学习笔记