Yes you can. But you will have to define a function for it.
from mock import Mock
def mock_create_fruit(fruit):
if fruit not in ('apple', 'banana'):
raise AssertionError('create_fruit not called with an allowed type, was %s' % (fruit,)
return type(fruit, (object,), {})()
my.factory.create_fruit = Mock(side_effect=mock_create_fruit)
The last line of our mock_create_fruit function is creating a class on the fly, creating an instance of it, and then returning it to the caller.