-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Version 2 Checker Duplicated * Test file missed * should have been commited before * Async removed as requested * final tidy * Extra File Removed
- Loading branch information
Showing
5 changed files
with
166 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...ns/azure-pylint-guidelines-checker/tests/test_files/invalid_use_of_overload_acceptable.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Test file for InvalidUseOfOverload checker | ||
|
||
from typing import overload, Union | ||
|
||
class testingOverload: | ||
@overload | ||
async def double(a: str): | ||
... | ||
|
||
@overload | ||
async def double(a: int): | ||
... | ||
|
||
async def double(a: Union[str, int]) -> int: | ||
if isinstance(a, str): | ||
return len(a)*2 | ||
return a * 2 | ||
|
||
|
||
@overload | ||
def single(a: str): | ||
... | ||
|
||
@overload | ||
def single(a: int): | ||
... | ||
|
||
def single(a: Union[str, int]) -> int: | ||
if isinstance(a, str): | ||
return len(a) | ||
return a |
31 changes: 31 additions & 0 deletions
31
...ons/azure-pylint-guidelines-checker/tests/test_files/invalid_use_of_overload_violation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Test file for InvalidUseOfOverload checker - testing what mypy doesn't pick up | ||
|
||
from typing import overload, Union | ||
|
||
class testingOverload: | ||
@overload | ||
def double(a: str): | ||
... | ||
|
||
@overload | ||
def double(a: int): | ||
... | ||
|
||
async def double(a: Union[str, int]): | ||
if isinstance(a, str): | ||
return len(a)*2 | ||
return a * 2 | ||
|
||
|
||
@overload | ||
async def doubleAgain(a: str) -> int: | ||
... | ||
|
||
@overload | ||
def doubleAgain(a: int) -> int: | ||
... | ||
|
||
async def doubleAgain(a: Union[str, int]) -> int: | ||
if isinstance(a, str): | ||
return len(a)*2 | ||
return a * 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters