python第三方库assertpy
https://github.com/ActivisionGameScience/assertpy assertpy是基于python的断言库 简介 安装 pip install assertpy 引用 from assertpy import assert_that 可用于python的pytest、nose等单元测试框架 可用于断言strings、numbers、lists、tuples、dicts、sets、Booleans、dates、files、object等 匹配字符串 类型判断 assert_that(’’).is_not_none()#不是null assert_that(’’).is_empty()#是空 assert_that(’’).is_false()#是false assert_that(’’).is_type_of(str)#是str的类型 assert_that(’’).is_instance_of(str)#是str的实例 常用 assert_that(‘foo’).is_length(3)#字符串长度是3 assert_that(‘foo’).is_not_empty()#不是空的 assert_that(‘foo’).is_true()#是true assert_that(‘foo’).is_alpha()#是字母 assert_that(