-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #274 from jakkdl/abstract_class_no_abstract_methods
Add b024: abstract class with no abstract methods
- Loading branch information
Showing
4 changed files
with
152 additions
and
0 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
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,91 @@ | ||
import abc | ||
import abc as notabc | ||
from abc import ABC, ABCMeta | ||
from abc import abstractmethod | ||
from abc import abstractmethod as abstract | ||
from abc import abstractmethod as abstractaoeuaoeuaoeu | ||
from abc import abstractmethod as notabstract | ||
|
||
import foo | ||
|
||
""" | ||
Should emit: | ||
B024 - on lines 17, 34, 52, 58, 69, 74, 84, 89 | ||
""" | ||
|
||
|
||
class Base_1(ABC): # error | ||
def method(self): | ||
... | ||
|
||
|
||
class Base_2(ABC): | ||
@abstractmethod | ||
def method(self): | ||
... | ||
|
||
|
||
class Base_3(ABC): | ||
@abc.abstractmethod | ||
def method(self): | ||
... | ||
|
||
|
||
class Base_4(ABC): | ||
@notabc.abstractmethod | ||
def method(self): | ||
... | ||
|
||
|
||
class Base_5(ABC): | ||
@abstract | ||
def method(self): | ||
... | ||
|
||
|
||
class Base_6(ABC): | ||
@abstractaoeuaoeuaoeu | ||
def method(self): | ||
... | ||
|
||
|
||
class Base_7(ABC): # error | ||
@notabstract | ||
def method(self): | ||
... | ||
|
||
|
||
class MetaBase_1(metaclass=ABCMeta): # error | ||
def method(self): | ||
... | ||
|
||
|
||
class MetaBase_2(metaclass=ABCMeta): | ||
@abstractmethod | ||
def method(self): | ||
... | ||
|
||
|
||
class abc_Base_1(abc.ABC): # error | ||
def method(self): | ||
... | ||
|
||
|
||
class abc_Base_2(metaclass=abc.ABCMeta): # error | ||
def method(self): | ||
... | ||
|
||
|
||
class notabc_Base_1(notabc.ABC): # safe | ||
def method(self): | ||
... | ||
|
||
|
||
class multi_super_1(notabc.ABC, abc.ABCMeta): # error | ||
def method(self): | ||
... | ||
|
||
|
||
class multi_super_2(notabc.ABC, metaclass=abc.ABCMeta): # error | ||
def method(self): | ||
... |
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