def test_kwargs(self): transformer = transforms.Transformer(utils.new_document('test data')) transformer.add_transform(TestTransform, foo=42) transformer.apply_transforms() self.assertEqual(len(transformer.applied), 1) self.assertEqual(len(transformer.applied[0]), 4) transform_record = transformer.applied[0] self.assertEqual(transform_record[1], TestTransform) self.assertEqual(transform_record[3], {'foo': 42})
def parse(self): """ No parsing to do; refurbish the document tree instead. Overrides the inherited method. """ self.document = self.input # Create fresh Transformer object, to be populated from Writer # component. self.document.transformer = transforms.Transformer(self.document) # Replace existing settings object with new one. self.document.settings = self.settings # Create fresh Reporter object because it is dependent on # (new) settings. self.document.reporter = utils.new_reporter( self.document.get('source', ''), self.document.settings)