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 TestAnnotations: 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 TestAnnotations: 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 TestAnnotations: 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 TestAnnotations: 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 TestAnnotations: 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 TestMakeClass: 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 @@ class TestNextGen: 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): """