I am trying to mock sqlbuilder.func for test cases with pytest I successfully mocked sqlbuilder.func.TO_BASE64 with correct output but when I tried mocking sqlbuilder.func.FROM_UNIXTIME I didn’t get any error but the resulted output is incorrect with the generated query. Below is the minimal working example of the problem. models.py conftest.py test_ex1.py Current SQL: Expected SQL: Edit Example Answer By default,