Skip to content

Commit

Permalink
Update Ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Jun 28, 2024
1 parent e1b2c94 commit 11288d5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.7
rev: v0.5.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
23 changes: 13 additions & 10 deletions tests/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ class C:

attr.resolve_types(C)

assert int == attr.fields(C).a.type
assert int is attr.fields(C).a.type

assert attr.Factory(list) == attr.fields(C).x.default
assert typing.List[int] == attr.fields(C).x.type
assert typing.List[int] is attr.fields(C).x.type

assert int == attr.fields(C).y.type
assert int is attr.fields(C).y.type
assert 2 == attr.fields(C).y.default

assert int == attr.fields(C).z.type
assert int is attr.fields(C).z.type

assert typing.Any == attr.fields(C).foo.type

Expand Down Expand Up @@ -534,15 +534,15 @@ class C:

attr.resolve_types(C, globals)

assert attr.fields(C).x.type == Annotated[float, "test"]
assert Annotated[float, "test"] is attr.fields(C).x.type

@attr.define
class D:
x: 'Annotated[float, "test"]'

attr.resolve_types(D, globals, include_extras=False)

assert attr.fields(D).x.type == float
assert float is attr.fields(D).x.type

def test_resolve_types_auto_attrib(self, slots):
"""
Expand Down Expand Up @@ -658,8 +658,8 @@ class B(A):
attr.resolve_types(A)
attr.resolve_types(B)

assert int == attr.fields(A).n.type
assert int == attr.fields(B).n.type
assert int is attr.fields(A).n.type
assert int is attr.fields(B).n.type

def test_resolve_twice(self):
"""
Expand All @@ -672,9 +672,12 @@ class A:
n: "int"

attr.resolve_types(A)
assert int == attr.fields(A).n.type

assert int is attr.fields(A).n.type

attr.resolve_types(A)
assert int == attr.fields(A).n.type

assert int is attr.fields(A).n.type


@pytest.mark.parametrize(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ class D:

cls = make_class("C", {})

assert cls.__mro__[-1] == object
assert cls.__mro__[-1] is object

cls = make_class("C", {}, bases=(D,))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_next_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_field_type(self):

A = attrs.make_class("A", classFields)

assert int == attrs.fields(A).testint.type
assert int is attrs.fields(A).testint.type

def test_no_slots(self):
"""
Expand Down

0 comments on commit 11288d5

Please sign in to comment.