python mocks cannot find reference 'assert_called_with' in 'function'

Viewed 411

I have these simple functions in python:

a.py

def fn1(a, b):
    return a + b


def fn1_reverted(a, b):
    return fn1(b, a)

and it's tests:

a_test.py

import a

def test_fn1():
    assert a.fn1('a', 'b') == 'ab'


def test_fn1_reverted(mocker):
    mocker.patch.object(a, 'fn1')
    a.fn1_reverted('a', 'b')
    a.fn1.assert_called_with('b', 'a')

I am getting this warning by pycharm: Cannot find reference 'assert_called_with' in 'function'

Am i doing something wrong?

Is this the correct way to assert that an internal function is called with specific params?

0 Answers
Related