[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
d7ca96cf28
commit
f6fef46265
|
@ -59,7 +59,6 @@ class SafeRepr(reprlib.Repr):
|
||||||
if self.use_ascii:
|
if self.use_ascii:
|
||||||
s = ascii(x)
|
s = ascii(x)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
s = super().repr(x)
|
s = super().repr(x)
|
||||||
except (KeyboardInterrupt, SystemExit):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -1018,9 +1018,7 @@ class AssertionRewriter(ast.NodeVisitor):
|
||||||
]
|
]
|
||||||
):
|
):
|
||||||
pytest_temp = self.variable()
|
pytest_temp = self.variable()
|
||||||
self.variables_overwrite[self.scope][
|
self.variables_overwrite[self.scope][v.left.target.id] = v.left # type:ignore[assignment]
|
||||||
v.left.target.id
|
|
||||||
] = v.left # type:ignore[assignment]
|
|
||||||
v.left.target.id = pytest_temp
|
v.left.target.id = pytest_temp
|
||||||
self.push_format_context()
|
self.push_format_context()
|
||||||
res, expl = self.visit(v)
|
res, expl = self.visit(v)
|
||||||
|
@ -1064,9 +1062,7 @@ class AssertionRewriter(ast.NodeVisitor):
|
||||||
if isinstance(arg, ast.Name) and arg.id in self.variables_overwrite.get(
|
if isinstance(arg, ast.Name) and arg.id in self.variables_overwrite.get(
|
||||||
self.scope, {}
|
self.scope, {}
|
||||||
):
|
):
|
||||||
arg = self.variables_overwrite[self.scope][
|
arg = self.variables_overwrite[self.scope][arg.id] # type:ignore[assignment]
|
||||||
arg.id
|
|
||||||
] # type:ignore[assignment]
|
|
||||||
res, expl = self.visit(arg)
|
res, expl = self.visit(arg)
|
||||||
arg_expls.append(expl)
|
arg_expls.append(expl)
|
||||||
new_args.append(res)
|
new_args.append(res)
|
||||||
|
@ -1074,9 +1070,7 @@ class AssertionRewriter(ast.NodeVisitor):
|
||||||
if isinstance(
|
if isinstance(
|
||||||
keyword.value, ast.Name
|
keyword.value, ast.Name
|
||||||
) and keyword.value.id in self.variables_overwrite.get(self.scope, {}):
|
) and keyword.value.id in self.variables_overwrite.get(self.scope, {}):
|
||||||
keyword.value = self.variables_overwrite[self.scope][
|
keyword.value = self.variables_overwrite[self.scope][keyword.value.id] # type:ignore[assignment]
|
||||||
keyword.value.id
|
|
||||||
] # type:ignore[assignment]
|
|
||||||
res, expl = self.visit(keyword.value)
|
res, expl = self.visit(keyword.value)
|
||||||
new_kwargs.append(ast.keyword(keyword.arg, res))
|
new_kwargs.append(ast.keyword(keyword.arg, res))
|
||||||
if keyword.arg:
|
if keyword.arg:
|
||||||
|
@ -1113,13 +1107,9 @@ class AssertionRewriter(ast.NodeVisitor):
|
||||||
if isinstance(
|
if isinstance(
|
||||||
comp.left, ast.Name
|
comp.left, ast.Name
|
||||||
) and comp.left.id in self.variables_overwrite.get(self.scope, {}):
|
) and comp.left.id in self.variables_overwrite.get(self.scope, {}):
|
||||||
comp.left = self.variables_overwrite[self.scope][
|
comp.left = self.variables_overwrite[self.scope][comp.left.id] # type:ignore[assignment]
|
||||||
comp.left.id
|
|
||||||
] # type:ignore[assignment]
|
|
||||||
if isinstance(comp.left, ast.NamedExpr):
|
if isinstance(comp.left, ast.NamedExpr):
|
||||||
self.variables_overwrite[self.scope][
|
self.variables_overwrite[self.scope][comp.left.target.id] = comp.left # type:ignore[assignment]
|
||||||
comp.left.target.id
|
|
||||||
] = comp.left # type:ignore[assignment]
|
|
||||||
left_res, left_expl = self.visit(comp.left)
|
left_res, left_expl = self.visit(comp.left)
|
||||||
if isinstance(comp.left, (ast.Compare, ast.BoolOp)):
|
if isinstance(comp.left, (ast.Compare, ast.BoolOp)):
|
||||||
left_expl = f"({left_expl})"
|
left_expl = f"({left_expl})"
|
||||||
|
@ -1137,9 +1127,7 @@ class AssertionRewriter(ast.NodeVisitor):
|
||||||
and next_operand.target.id == left_res.id
|
and next_operand.target.id == left_res.id
|
||||||
):
|
):
|
||||||
next_operand.target.id = self.variable()
|
next_operand.target.id = self.variable()
|
||||||
self.variables_overwrite[self.scope][
|
self.variables_overwrite[self.scope][left_res.id] = next_operand # type:ignore[assignment]
|
||||||
left_res.id
|
|
||||||
] = next_operand # type:ignore[assignment]
|
|
||||||
next_res, next_expl = self.visit(next_operand)
|
next_res, next_expl = self.visit(next_operand)
|
||||||
if isinstance(next_operand, (ast.Compare, ast.BoolOp)):
|
if isinstance(next_operand, (ast.Compare, ast.BoolOp)):
|
||||||
next_expl = f"({next_expl})"
|
next_expl = f"({next_expl})"
|
||||||
|
|
|
@ -19,7 +19,6 @@ from typing import Generator
|
||||||
from typing import Mapping
|
from typing import Mapping
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
import zipfile
|
import zipfile
|
||||||
import re
|
|
||||||
|
|
||||||
import _pytest._code
|
import _pytest._code
|
||||||
from _pytest._io.saferepr import DEFAULT_REPR_MAX_SIZE
|
from _pytest._io.saferepr import DEFAULT_REPR_MAX_SIZE
|
||||||
|
@ -36,7 +35,6 @@ from _pytest.config import Config
|
||||||
from _pytest.config import ExitCode
|
from _pytest.config import ExitCode
|
||||||
from _pytest.pathlib import make_numbered_dir
|
from _pytest.pathlib import make_numbered_dir
|
||||||
from _pytest.pytester import Pytester
|
from _pytest.pytester import Pytester
|
||||||
from _pytest.assertion.rewrite import _saferepr
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue