Answer the question
In order to leave comments, you need to log in
What is Matcher for?
There is such a dock PyHamcrest Tutorial . To be honest, "I look in the book, I see a fig." What for?
Can anyone explain on the fingers what is the feature of matchers, why is it better with them than without them?
UPD :
The answers included Sergey Protko 's opinion to compare the expected with the actual. But what is the fundamental difference between using matchers and using code constructs with assert() ? After all, assert() also compares the actual with the expected.
Answer the question
In order to leave comments, you need to log in
to compare values expected and available. Nothing without them. And custom matchers - in order to eliminate duplication in tests and simplify their writing.
A) For checks that are difficult to write manually. Example - how to make a check through a regular assert that a certain expression crashes when a function is called?
B) For human-readable checks.
C) To reduce coding. As an example, here https://habrahabr.ru/company/yandex/blog/242795/ BaseModifyMatcher makes writing checks very easy
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question