当前位置:网站首页>Pytest assert encapsulation
Pytest assert encapsulation
2022-06-25 21:19:00 【Strange meow】
because pytest Self contained assert When the assertion fails , The actual and expected results of the failure will not be printed , Bring invariance to the view , So it is necessary to package, format and print
import logging
import pytest
from common.baselogger import logger
def assert_equal(actual, expected):
assert actual == expected, " The actual result is :{0}, The expected result is :{1}".format(actual, expected)
def assert_not_equal(a, b):
assert a != b, "{0} be equal to {1}".format(a, b)
def assert_in(a, b):
assert a in b, "{0} It doesn't contain {1}".format(b, a)
def assert_true(value):
assert value, "{0} For false ".format(value)
边栏推荐
- Cross project measurement is a good helper for CTOs and PMOS
- Record some questions about MySQL (DNS reverse resolution in Linux)
- 启牛证券开户安全嘛?
- Heavy update! Yolov4 latest paper! Interpreting yolov4 framework
- Mysqldumpslow out slow statements in the database
- Beginner to embedded development
- Volatile qualifier
- js (1)
- Sqlmap for interface security testing
- Yolov4 improved version comes out! Yolov4 extended edition! Yolov4 launched scaled-yolov4: scaling cross stage partial network
猜你喜欢

Compile 6relayd using the cross compiler

Insert and update each database

Dbeaver offline installation driver

lombok

Free your hands and automatically brush Tiktok

Summary of several methods for FPS calculation
[distributed system design profile (1)] raft

What is DNS (domain name server)? (Powercert animated videos)

STM32 self balancing robot project, with code, circuit diagram and other data attached at the end (learning materials and learning group at the end)

MySQL is slow to add indexes_ Why is your SQL so slow? Why is your MySQL index invalid?
随机推荐
Basic knowledge of software engineering required for soft test
2022年启牛学堂证券开户安全嘛?
Virtualenvwrapper solves the installation error, and virtualenvwrapper is permanently effective
Inventory - those automated test interview questions you can't help but know
Code program related problems troubleshooting directory
[data recovery in North Asia] a data recovery case in which the upper virtual machine data is lost due to the hard disk failure and disconnection of raid6 disk array
Molecular dynamics - basic characteristics of molecular force field
[distributed system design profile (1)] raft
Record some questions about MySQL (DNS reverse resolution in Linux)
05 configuring network parameters
同花顺炒股软件开户是合法的吗?安全吗
How to write an infinite loop
Insert and update each database
What is an app circle of friends advertisement
IPtables
Command 'GCC' failed with exit status 1 when PIP install mysqlclient
The SH runtime directly reported an error syntax error near unexpected token ` $'. \r‘
Get parameters in URL
Unable to connect to the server remotely locally using the Jupiter notebook
Soft test intermediate simple notes