swansonk14 / typed-argument-parser

Typed argument parser for Python
MIT License
494 stars 40 forks source link

Hashtag on final line of multiline assignment is not registered as a comment #147

Open swansonk14 opened 2 weeks ago

swansonk14 commented 2 weeks ago

In a multiline assign statement, a hashtag comment on the final line is not registered as a comment and is thus not included in the Tap help string. See below for a test that fails under the current implementation.

def test_multiline_argument_hashtag(self):
    class MultilineArgument:
        bar: str = (
            "This is a multiline argument"
            " that should not be included in the docstring"
        )  # biz baz

    class_variables = {"bar": {"comment": "biz baz"}}
    self.assertEqual(get_class_variables(MultilineArgument), class_variables)