Add batch_cls as a property of a service, and as a parameter to the constructor.
Allow users to subclass service and substitute the class used for the batch by changing the default parameter:
python
class MockBatch(Batch):
def __init__(self, ...):
add new properties here
super().__init__(...)
class MockService(..., Service):
def __init__(self, **kwargs):
super().__init__(batch_cls=MockBatch, **kwargs)
... alternatively pass a pseudo constructor function that returns a configured Mock:
python
def mock_batch():
"""Likely this is a test fixture.
batch = Batch(...)
monkey patch up batch here...
return batch
class MockService(..., Service):
def __init__(self, **kwargs):
super().__init__(batch_cls=mock_batch, **kwargs)