当前位置:网站首页>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)
边栏推荐
- Lesson 1 Preparation
- Alicloud disk mounted locally
- Rounding related calculation
- The super easy-to-use test tool sorted out by Ali P8 for a week
- Is flush app regular? Is it safe or not
- Get parameters in URL
- [nailing scenario capability package] enterprise and public institution intelligent access control
- Renren mall locates the file according to the route
- Is it safe for qiniu school to open an account in 2022?
- Lesson 3 urllib
猜你喜欢

The correct way to clear the cache of the computer. The computer will not get stuck immediately after changing. practical
Uncover n core 'black magic' of Presto + alluxio
![[nailing scenario capability package] enterprise and public institution intelligent access control](/img/0e/43433ca5586c48d01708e5fa39a808.jpg)
[nailing scenario capability package] enterprise and public institution intelligent access control

Beginner to embedded development

Explain memcached principle in detail

Alicloud disk mounted locally

Differences between modems and routers (powercert animated videos)

01 network basics

C language soul torture: do you know the difference between the two?

Summary of several methods for FPS calculation
随机推荐
IPtables
Using two stacks to realize the function of one queue?
[nailing scenario capability package] ranking of enterprise employees' points
After 20 days' interview, I finally joined Ali (share the interview process)
What is a subnet mask? (Powercert animated videos)
Openocd compilation and installation
Shell syntax
CANoe. Diva operation guide TP layer test
Basic knowledge of software engineering required for soft test
JVM Foundation
A simple file searcher
Section 13: simplify your code with Lombok
What is machine learning? (Fundamentals)
Differences between modems and routers (powercert animated videos)
MySQL is slow to add indexes_ Why is your SQL so slow? Why is your MySQL index invalid?
1.0-mq getting started and using
Unable to connect to the server remotely locally using the Jupiter notebook
04 disk space management
Soft test intermediate simple notes
Kubernetes related knowledge - surprise interview