Pycharm#
mise#
Install the plugin from https://plugins.jetbrains.com/plugin/24904-mise
In the settings, be sure to use environment variables:
Fix actual / expected#
In Advanced Settings check
Swap the order of actual and expected assertions in Pytest
.Profit.
OK, this might have been a little bit on the short side, so here’s some background.
I usually write pytests like this: python def test(): assert list('hi') == ['h', 'i']
You could read that as assert actual == expected
.
The problem is that in Pycharm’s excellent diff view (<Click to see difference>
), “expected” and “actual” are the other way around.
For short data, you would not even notice, because you would not need the diff view, but for long data and deep thought, it is very distracting if expected and actual do not match reality. Thank you Jetbrains for making this configurable! 🖖