August 2018
Beginner
160 pages
4h 8m
English
As you've probably already noticed, pytest makes use of the built-in assert statement to check assumptions during testing. Contrary to other frameworks, you don't need to remember various self.assert* or self.expect* functions. While this may not seem like a big deal at first, after spending some time using plain asserts, you will realize how much that makes writing tests more enjoyable and natural.
Again, here's an example of a failure:
________________________ test_default_health ________________________ def test_default_health(): health = get_default_health('warrior')> assert health == 95E assert 80 == 95tests\test_assert_demo.py:25: AssertionError
Pytest shows the line of the failure, as well as the variables and expressions ...
Read now
Unlock full access