diff options
author | Larry Hastings <larry@hastings.org> | 2014-01-18 01:47:17 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2014-01-18 01:47:17 (GMT) |
commit | bebf73511a1250fc768bcb7192b5b3c3fd04d8f2 (patch) | |
tree | 1566a4813db5454e821d702e7a42fbd3221f8c79 /Tools/clinic/clinic_test.py | |
parent | 601d3668444f7bbe73a3aecc7109c6f471dc3c16 (diff) | |
download | cpython-bebf73511a1250fc768bcb7192b5b3c3fd04d8f2.zip cpython-bebf73511a1250fc768bcb7192b5b3c3fd04d8f2.tar.gz cpython-bebf73511a1250fc768bcb7192b5b3c3fd04d8f2.tar.bz2 |
Issue #20287: Argument Clinic's output is now configurable, allowing
delaying its output or even redirecting it to a separate file.
Diffstat (limited to 'Tools/clinic/clinic_test.py')
-rw-r--r-- | Tools/clinic/clinic_test.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Tools/clinic/clinic_test.py b/Tools/clinic/clinic_test.py index 6472527..0226ce6 100644 --- a/Tools/clinic/clinic_test.py +++ b/Tools/clinic/clinic_test.py @@ -34,6 +34,9 @@ class FakeConvertersDict: def get(self, name, default): return self.used_converters.setdefault(name, FakeConverterFactory(name)) +clinic.Clinic.presets_text = '' +c = clinic.Clinic(language='C') + class FakeClinic: def __init__(self): self.converters = FakeConvertersDict() @@ -44,6 +47,32 @@ class FakeClinic: self.modules = 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 get_destination(self, name): + d = self.destinations.get(name) + if not d: + sys.exit("Destination does not exist: " + repr(name)) + return d + + def add_destination(self, name, type, *args): + if name in self.destinations: + sys.exit("Destination already exists: " + repr(name)) + self.destinations[name] = clinic.Destination(name, type, self, *args) def is_directive(self, name): return name == "module" |