def test_temp_filename(mock_tmp): fn = Mock() type(fn).name = PropertyMock(return_value="Junk.test") mock_tmp.return_value = fn r = biu.temp_filename("test") assert r == "Junk.test" assert mock_tmp.called assert mock_tmp.call_args[0] == () assert mock_tmp.call_args[1] == {'suffix': '.test'}