diff --git a/resources/test/fixtures/N807.py b/resources/test/fixtures/N807.py index f9513ce71c..42f5152403 100644 --- a/resources/test/fixtures/N807.py +++ b/resources/test/fixtures/N807.py @@ -10,6 +10,27 @@ def good__(): pass +def nested(): + def __bad__(): + pass + + def __good(): + pass + + def good__(): + pass + + class Class: def __good__(self): pass + + +# https://peps.python.org/pep-0562/ +def __getattr__(name): + pass + + +# https://peps.python.org/pep-0562/ +def __dir__(): + pass diff --git a/src/pep8_naming/checks.rs b/src/pep8_naming/checks.rs index 048574ebe6..f819615d73 100644 --- a/src/pep8_naming/checks.rs +++ b/src/pep8_naming/checks.rs @@ -132,6 +132,11 @@ pub fn dunder_function_name(scope: &Scope, stmt: &Stmt, name: &str) -> Option