diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-10-01 22:06:06 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2022-10-10 11:15:38 +0200 |
commit | 66ae21cd9eaf8f726c306e2176ee1b029e86fe6a (patch) | |
tree | 0f3ac87abae7589b0e48b3c55316d0eb7c1b190b /tests/functional | |
parent | 983d5fc514e8e67ad0944365087efb8b5df05efe (diff) | |
download | pylint-git-66ae21cd9eaf8f726c306e2176ee1b029e86fe6a.tar.gz |
Check `` py-version`` for async ``unnecessary-dunder-call`` (#7549)
Diffstat (limited to 'tests/functional')
5 files changed, 36 insertions, 0 deletions
diff --git a/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py310.py b/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py310.py new file mode 100644 index 000000000..c2ab58a57 --- /dev/null +++ b/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py310.py @@ -0,0 +1,15 @@ +"""Checks for unnecessary-dunder-call on __aiter__/__anext__ with py-version=3.10.""" + + +class MyClass: + """A class implementing __aiter__ and __anext__.""" + + def __aiter__(self): + ... + + async def __anext__(self): + ... + + +MyClass().__aiter__() # [unnecessary-dunder-call] +MyClass().__anext__() # [unnecessary-dunder-call] diff --git a/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py310.rc b/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py310.rc new file mode 100644 index 000000000..7d7b7aa0c --- /dev/null +++ b/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py310.rc @@ -0,0 +1,2 @@ +[master] +py-version=3.10 diff --git a/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py310.txt b/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py310.txt new file mode 100644 index 000000000..bcb5647f9 --- /dev/null +++ b/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py310.txt @@ -0,0 +1,2 @@ +unnecessary-dunder-call:14:0:14:21::Unnecessarily calls dunder method __aiter__. Use aiter built-in function.:HIGH +unnecessary-dunder-call:15:0:15:21::Unnecessarily calls dunder method __anext__. Use anext built-in function.:HIGH diff --git a/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py39.py b/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py39.py new file mode 100644 index 000000000..589524170 --- /dev/null +++ b/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py39.py @@ -0,0 +1,15 @@ +"""Checks for unnecessary-dunder-call on __aiter__/__anext__ with py-version=3.9.""" + + +class MyClass: + """A class implementing __aiter__ and __anext__.""" + + def __aiter__(self): + ... + + async def __anext__(self): + ... + + +MyClass().__aiter__() +MyClass().__anext__() diff --git a/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py39.rc b/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py39.rc new file mode 100644 index 000000000..aed012f73 --- /dev/null +++ b/tests/functional/u/unnecessary/unnecessary_dunder_call_async_py39.rc @@ -0,0 +1,2 @@ +[MAIN] +py-version=3.9 |