As another answer mentioned, you can use the Python mock library to make assertions about calls to functions/methods
from mock import patch
from my_module import HelloTest
import unittest
class TestFoo(unittest.TestCase):
@patch('hello.HelloTest.bar')
def test_foo_case(self, mock_bar):
ht = HelloTest()
ht.foo("some string")
self.assertTrue(mock_bar.called)
self.assertEqual(mock_bar.call_args[0][0], "SOME STRING")
This patches out the bar method on HelloTest and replaces it with a mock object that records calls against it.
Mocking is a bit of a rabbit hole. Only do it when you absolutely have to because it does make your tests brittle. You’ll never notice an API change for a mocked object for instance.