From 11288d5709da70d123951663570d380838cd1c1a Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Fri, 28 Jun 2024 09:41:56 +0200 Subject: [PATCH] Update Ruff --- .pre-commit-config.yaml | 2 +- tests/test_annotations.py | 23 +++++++++++++---------- tests/test_make.py | 2 +- tests/test_next_gen.py | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cd9cf25c..be1ec596 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/tests/test_annotations.py b/tests/test_annotations.py index d27d9e37..516c53ff 100644 --- a/tests/test_annotations.py +++ b/tests/test_annotations.py @@ -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 @@ -534,7 +534,7 @@ 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: @@ -542,7 +542,7 @@ class D: 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): """ @@ -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): """ @@ -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( diff --git a/tests/test_make.py b/tests/test_make.py index 736ab8cf..a5490f9e 100644 --- a/tests/test_make.py +++ b/tests/test_make.py @@ -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,)) diff --git a/tests/test_next_gen.py b/tests/test_next_gen.py index 7d053d21..a46183e0 100644 --- a/tests/test_next_gen.py +++ b/tests/test_next_gen.py @@ -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): """