Skip to content

Commit

Permalink
Style.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Nov 10, 2024
1 parent 028b529 commit 0767236
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
5 changes: 4 additions & 1 deletion regret/_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

from __future__ import annotations

from typing import Any, Callable, Iterable
from typing import TYPE_CHECKING, Any
import inspect

if TYPE_CHECKING:
from collections.abc import Callable, Iterable

from attrs import evolve, field, frozen


Expand Down
3 changes: 2 additions & 1 deletion regret/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
from regret.emitted import Deprecation

if TYPE_CHECKING:
from typing import Any, Iterator
from collections.abc import Iterator
from typing import Any

from regret.typing import Deprecatable

Expand Down
36 changes: 21 additions & 15 deletions regret/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,15 +605,18 @@ def test_function_parameter_warns_despite_error(self):
def divide_by_zero(x):
raise ZeroDivisionError()

with self.recorder.expect(
kind=Parameter(
callable=divide_by_zero,
parameter=inspect.Parameter(
name="x",
kind=inspect.Parameter.POSITIONAL_OR_KEYWORD,
with (
self.recorder.expect(
kind=Parameter(
callable=divide_by_zero,
parameter=inspect.Parameter(
name="x",
kind=inspect.Parameter.POSITIONAL_OR_KEYWORD,
),
),
),
), self.assertRaises(ZeroDivisionError):
self.assertRaises(ZeroDivisionError),
):
divide_by_zero(3)

def test_function_with_deprecated_parameter_is_wrapped(self):
Expand Down Expand Up @@ -1660,16 +1663,19 @@ def test_optional_function_parameter_warns_despite_error(self):
def divide_by_zero(x):
raise ZeroDivisionError()

with self.recorder.expect(
kind=OptionalParameter(
callable=divide_by_zero,
default=0,
parameter=inspect.Parameter(
name="x",
kind=inspect.Parameter.POSITIONAL_OR_KEYWORD,
with (
self.recorder.expect(
kind=OptionalParameter(
callable=divide_by_zero,
default=0,
parameter=inspect.Parameter(
name="x",
kind=inspect.Parameter.POSITIONAL_OR_KEYWORD,
),
),
),
), self.assertRaises(ZeroDivisionError):
self.assertRaises(ZeroDivisionError),
):
divide_by_zero()

def test_inheritance(self):
Expand Down

0 comments on commit 0767236

Please sign in to comment.