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

Commit

Permalink
Added Tests for valid overloaded nested functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
theyuvalraz committed Sep 13, 2020
1 parent 805ee78 commit f66a3bb
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,36 @@ def overloaded_func(a):
assert 'D103' not in out


def test_overload_nested_function_valid(env):
"""Valid case for overload decorated nested functions.
This shouldn't throw any errors.
"""
with env.open('example.py', 'wt') as example:
example.write(textwrap.dedent('''\
from typing import overload
def function_with_nesting():
"""Adding a docstring to a function."""
@overload
def overloaded_func(a: int) -> str:
...
@overload
def overloaded_func(a: str) -> str:
...
def overloaded_func(a):
"""Foo bar documentation."""
return str(a)
'''))
env.write_config(ignore="D100")
out, err, code = env.invoke()
assert code == 0


def test_conflicting_select_ignore_config(env):
"""Test that select and ignore are mutually exclusive."""
env.write_config(select="D100", ignore="D101")
Expand Down

0 comments on commit f66a3bb

Please sign in to comment.