From 3a3e8a1ba0b4c06e7f0af3fc1cb3532fa5c7d26c Mon Sep 17 00:00:00 2001 From: Kyle Swanson Date: Sun, 19 Jul 2020 23:21:12 -0400 Subject: [PATCH] Changing separator between single and multiline comments to space --- tap/utils.py | 2 +- tests/test_utils.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tap/utils.py b/tap/utils.py index ca11bb2..0d1cbef 100644 --- a/tap/utils.py +++ b/tap/utils.py @@ -213,7 +213,7 @@ def get_class_variables(cls: type) -> OrderedDict: if (class_variable is not None and token['token_type'] == tokenize.STRING and token['token'][:3] in {'"""', "'''"}): - sep = '\n\n' if variable_to_comment[class_variable]['comment'] else '' + sep = ' ' if variable_to_comment[class_variable]['comment'] else '' variable_to_comment[class_variable]['comment'] += sep + token['token'][3:-3].strip() # Match class variable diff --git a/tests/test_utils.py b/tests/test_utils.py index 3c97df5..fe57d30 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -215,7 +215,7 @@ def func(self): class_variables = OrderedDict() class_variables['arg_1'] = {'comment': 'Arg 1 comment'} class_variables['arg_2'] = {'comment': 'Arg 2 comment'} - class_variables['arg_3'] = {'comment': 'Poorly formatted comment\n\nMore comment'} + class_variables['arg_3'] = {'comment': 'Poorly formatted comment More comment'} self.assertEqual(get_class_variables(CommentedVariable), class_variables) def test_bad_spacing_multiline(self): @@ -237,7 +237,7 @@ class TrickyMultiline: """ class_variables = OrderedDict() - comment = 'Header line\n\nFooter\nT\n A\n P\n\n multi\n line!!' + comment = 'Header line Footer\nT\n A\n P\n\n multi\n line!!' class_variables['foo'] = {'comment': comment} self.assertEqual(get_class_variables(TrickyMultiline), class_variables) @@ -254,9 +254,9 @@ def test_functions_with_docs_multiline(self): class FunctionsWithDocs: i: int = 0 - def f(): + def f(self): """Function""" - a: str = 0 + a: str = 'hello' """with docs""" class_variables = OrderedDict()