How to navigate between test and test subject in PyCharm if function name starts with "_"?

16 views Asked by At

If I have a function "baa" and a corresponding unit test "test_baa", I am able to use Ctr+Shift+T to navigate between test and test subject, also see

https://www.jetbrains.com/help/pycharm/navigating-between-test-and-test-subject.html

However, if I rename the function "baa" to "_baa" and the test to "test__baa", the navigation does not work any more. Keeping the original name "test_baa" also did not work.

=> How can I navigate between test and test subject in PyCharm, if the function name starts with "_"?

enter image description here

foo.py:

def _baa():
    return 1

test_foo.py:

from foo import _baa


def test__baa():
    result = _baa()
    assert result == 1

=> Error:

enter image description here

0

There are 0 answers