Search code examples
pythonpytestpython-unittest

What is the correct order for actual and expected in pytest?


This question gives the order assertEqual(expected, actual), albeit for the unittest package.

But Pycharm, with pytest, prints out "Expected:..." and "Actual..." based on the order actual==expected.

This is confusing. What is the correct ordering for pytest? The source code and online documentation do not say.

(I note also that JUnit and TestNG disagree on this.)


Solution

  • BDFL doesn't like actual/expected terminology and the docs were specifically changed to address this.

    If your tooling is expecting arguments in a certain order, then I suppose the most correct thing to do would be to consistently do what works for your tooling.