mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 12:15:08 +02:00
Fix test-before-setup IQS check (#133467)
This commit is contained in:
@@ -17,13 +17,20 @@ _VALID_EXCEPTIONS = {
|
|||||||
|
|
||||||
def _get_exception_name(expression: ast.expr) -> str:
|
def _get_exception_name(expression: ast.expr) -> str:
|
||||||
"""Get the name of the exception being raised."""
|
"""Get the name of the exception being raised."""
|
||||||
|
if expression is None:
|
||||||
|
# Bare raise
|
||||||
|
return None
|
||||||
|
|
||||||
if isinstance(expression, ast.Name):
|
if isinstance(expression, ast.Name):
|
||||||
|
# Raise Exception
|
||||||
return expression.id
|
return expression.id
|
||||||
|
|
||||||
if isinstance(expression, ast.Call):
|
if isinstance(expression, ast.Call):
|
||||||
|
# Raise Exception()
|
||||||
return _get_exception_name(expression.func)
|
return _get_exception_name(expression.func)
|
||||||
|
|
||||||
if isinstance(expression, ast.Attribute):
|
if isinstance(expression, ast.Attribute):
|
||||||
|
# Raise namespace.???
|
||||||
return _get_exception_name(expression.value)
|
return _get_exception_name(expression.value)
|
||||||
|
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
|
Reference in New Issue
Block a user