Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Python3.12: Two tests fail #652

Closed
penguinpee opened this issue Sep 2, 2023 · 1 comment
Closed

Python3.12: Two tests fail #652

penguinpee opened this issue Sep 2, 2023 · 1 comment

Comments

@penguinpee
Copy link

Fedora's next release will ship with Python3.12. Rebuilding pydocstyle saw two tests failing:

=================================== FAILURES ===================================
_____________________________ test_simple_fstring ______________________________

    def test_simple_fstring():
        """Test parsing of a function with a simple fstring as a docstring."""
        parser = Parser()
        code = CodeSnippet("""\
            def do_something(pos_param0, pos_param1, kw_param0="default"):
                f\"""Do something.\"""
                return None
        """)
        module = parser.parse(code, 'file_path')
        assert module.is_public
        assert module.dunder_all is None
    
        function, = module.children
        assert function.name == 'do_something'
        assert function.decorators == []
        assert function.children == []
>       assert function.docstring == 'f"""Do something."""'
E       assert None == 'f"""Do something."""'
E        +  where None = Function(name='do_something', _source=['def do_something(pos_param0, pos_param1, kw_param0="default"):\n', '    f"""Do something."""\n', '    return None\n'], start=1, end=3, decorators=[], docstring=None, children=[], callable_args=['pos_param0', 'pos_param1', 'kw_param0'], parent=Module(name='file_path', _source=['def do_something(pos_param0, pos_param1, kw_param0="default"):\n', '    f"""Do something."""\n', '    return None\n'], start=1, end=4, decorators=[], docstring=None, children=[Function(name='do_something', _source=['def do_something(pos_param0, pos_param1, kw_param0="default"):\n', '    f"""Do something."""\n', '    return None\n'], start=1, end=3, decorators=[], docstring=None, children=[], callable_args=['pos_param0', 'pos_param1', 'kw_param0'], parent=Module(name='file_path', _source=['def do_something(pos_param0, pos_param1, kw_param0="default"):\n', '    f"""Do something."""\n', '    return None\n'], start=1, end=4, decorators=[], docstring=None, children=[...], parent=None, _dunder_all=None, dunder_all_error=None, future_imports=set(), skipped_error_codes=''), skipped_error_codes='')], parent=None, _dunder_all=None, dunder_all_error=None, future_imports=set(), skipped_error_codes=''), skipped_error_codes='').docstring

src/tests/parser_test.py:69: AssertionError
____________________________ test_fstring_with_args ____________________________

    def test_fstring_with_args():
        """Test parsing of a function with an fstring with args as a docstring."""
        parser = Parser()
        code = CodeSnippet("""\
            foo = "bar"
            bar = "baz"
            def do_something(pos_param0, pos_param1, kw_param0="default"):
                f\"""Do some {foo} and some {bar}.\"""
                return None
        """)
        module = parser.parse(code, 'file_path')
        assert module.is_public
        assert module.dunder_all is None
    
        function, = module.children
        assert function.name == 'do_something'
        assert function.decorators == []
        assert function.children == []
>       assert function.docstring == 'f"""Do some {foo} and some {bar}."""'
E       assert None == 'f"""Do some {foo} and some {bar}."""'
E        +  where None = Function(name='do_something', _source=['foo = "bar"\n', 'bar = "baz"\n', 'def do_something(pos_param0, pos_param1, kw_param0="default"):\n', '    f"""Do some {foo} and some {bar}."""\n', '    return None\n'], start=3, end=5, decorators=[], docstring=None, children=[], callable_args=['pos_param0', 'pos_param1', 'kw_param0'], parent=Module(name='file_path', _source=['foo = "bar"\n', 'bar = "baz"\n', 'def do_something(pos_param0, pos_param1, kw_param0="default"):\n', '    f"""Do some {foo} and some {bar}."""\n', '    return None\n'], start=1, end=6, decorators=[], docstring=None, children=[Function(name='do_something', _source=['foo = "bar"\n', 'bar = "baz"\n', 'def do_something(pos_param0, pos_param1, kw_param0="default"):\n', '    f"""Do some {foo} and some {bar}."""\n', '    return None\n'], start=3, end=5, decorators=[], docstring=None, children=[], callable_args=['pos_param0', 'pos_param1', 'kw_param0'], parent=Module(name='file_path', _source=['foo = "bar"\n', 'bar = "baz"\n', 'def do_something(pos_param0, pos_param1, kw_param0="default"):\n', '    f"""Do some {foo} and some {bar}."""\n', '    return None\n'], start=1, end=6, decorators=[], docstring=None, children=[...], parent=None, _dunder_all=None, dunder_all_error=None, future_imports=set(), skipped_error_codes=''), skipped_error_codes='')], parent=None, _dunder_all=None, dunder_all_error=None, future_imports=set(), skipped_error_codes=''), skipped_error_codes='').docstring

src/tests/parser_test.py:100: AssertionError
======================== 2 failed, 212 passed in 17.65s ========================
@penguinpee
Copy link
Author

I should have read before reporting. The package maintainer already reported that in #646.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant