def __init__(self): self.converters = FakeConvertersDict() self.legacy_converters = FakeConvertersDict() self.language = clinic.CLanguage(None) self.filename = None self.destination_buffers = {} self.block_parser = clinic.BlockParser('', self.language) self.modules = collections.OrderedDict() self.classes = collections.OrderedDict() clinic.clinic = self self.name = "FakeClinic" self.line_prefix = self.line_suffix = '' self.destinations = {} self.add_destination("block", "buffer") self.add_destination("file", "buffer") self.add_destination("suppress", "suppress") d = self.destinations.get self.field_destinations = collections.OrderedDict(( ('docstring_prototype', d('suppress')), ('docstring_definition', d('block')), ('methoddef_define', d('block')), ('impl_prototype', d('block')), ('parser_prototype', d('suppress')), ('parser_definition', d('block')), ('impl_definition', d('block')), ))
def _test(self, input, output): language = clinic.CLanguage(None) blocks = list(clinic.BlockParser(input, language)) writer = clinic.BlockPrinter(language) for block in blocks: writer.print_block(block) output = writer.f.getvalue() assert output == input, "output != input!\n\noutput " + repr(output) + "\n\n input " + repr(input)
def __init__(self): self.converters = FakeConvertersDict() self.legacy_converters = FakeConvertersDict() self.language = clinic.CLanguage() self.filename = None self.block_parser = clinic.BlockParser('', self.language) self.modules = collections.OrderedDict() clinic.clinic = self self.name = "FakeClinic"