D
D
Dmitry2015-07-29 14:14:59
Python
Dmitry, 2015-07-29 14:14:59

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

2 answer(s)
S
Sergey, 2015-07-29
Protko @Fesor

to compare values ​​expected and available. Nothing without them. And custom matchers - in order to eliminate duplication in tests and simplify their writing.

D
Danil Biryukov-Romanov, 2016-03-28
@urtow

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 question

Ask a Question

731 491 924 answers to any question