Tree in Africa
Photo by Damian Patkowski on Unsplash

Pytest’s assert is not what you think it is

What is AST? And how pytest hacks it to give you a better UX?

Tarek Amr
CodeX
Published in
6 min readJun 19, 2022

--

In Python, like many other languages, there is a statement that checks a given condition, and raises an AssertionError if this condition is False, otherwise, it does nothing if the given condition is True. That’s basically what assert does.

--

--

Tarek Amr
CodeX
Writer for

I write about what machines can learn from data, what humans can learn from machines, and what businesses can learn from all three.