One function that makes the string matchable
Project description
full_match
When catching exceptions in Pytest, sometimes you need to check messages. Since the user sends a pattern for searching, and not a message for exact matching, sometimes similar, but not identical messages pass through the filter. This micro-library contains a function that makes Pytest check exception messages accurately.
It may also be useful to you if you use mutation testing tools such as mutmut.
Install it:
pip install full_match
And use:
import pytest
import full_match
def test_something():
with pytest.raises(AssertionError, match='Regex pattern did not match.'):
with pytest.raises(ValueError, match=full_match('Some message.')):
raise ValueError('XXSome message.XX')
The message in the inner with
block does not match the pattern exactly, so an AssertionError
exception will occur in this example.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file full_match-0.0.1.tar.gz
.
File metadata
- Download URL: full_match-0.0.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fb06fb34d4a56a635f45f30260847751b40299cd6636f2dbf51dda349deeb11 |
|
MD5 | f0c16736f9a49aabc8b5ba4a8c99cacc |
|
BLAKE2b-256 | 5028298853b03f54ed0a438091828d8151db105c0045df30afbb530214c7c288 |
File details
Details for the file full_match-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: full_match-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 148d2b138065f952b889ea8ad4327df8a2df1c1b2fcc2f42dbe54c9cd4fcc171 |
|
MD5 | 5fdd891db6a9ec151f8b933ce1836c54 |
|
BLAKE2b-256 | eeb1a342573fd019305dfe00123257842cab3f8f0cee631b006c5f6bc05a8d1b |