Skip to content

Commit 4895547

Browse files
authored
feat: bump ruff (#194)
Signed-off-by: nstarman <[email protected]>
1 parent 9139641 commit 4895547

File tree

8 files changed

+25
-25
lines changed

8 files changed

+25
-25
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repos:
2828
- id: trailing-whitespace
2929

3030
- repo: https://github.com/astral-sh/ruff-pre-commit
31-
rev: "v0.4.1"
31+
rev: "v0.7.3"
3232
hooks:
3333
# Run the linter
3434
- id: ruff

plum/parametric.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,4 +672,4 @@ def __repr__(self) -> str:
672672
return repr_short(type(self)) + "()"
673673

674674
def __eq__(self, other):
675-
return type(self) == type(other)
675+
return type(self) is type(other)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dev = [
4040
"jupyter-book",
4141
"mypy",
4242
"pyright>=1.1.331",
43-
"ruff==0.1.0",
43+
"ruff>=0.2.1",
4444
"sybil",
4545
]
4646

tests/advanced/test_precedence.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ def test_precedence():
4646
el = Element()
4747
spel = SpecialisedElement()
4848

49-
assert type(mul(zero, el)) == ZeroElement
50-
assert type(mul(el, spel)) == SpecialisedElement
49+
assert type(mul(zero, el)) is ZeroElement
50+
assert type(mul(el, spel)) is SpecialisedElement
5151
with pytest.raises(AmbiguousLookupError):
5252
mul(zero, spel)
5353

54-
assert type(mul_precedence(zero, el)) == ZeroElement
55-
assert type(mul_precedence(el, spel)) == SpecialisedElement
56-
assert type(mul_precedence(zero, spel)) == ZeroElement
54+
assert type(mul_precedence(zero, el)) is ZeroElement
55+
assert type(mul_precedence(el, spel)) is SpecialisedElement
56+
assert type(mul_precedence(zero, spel)) is ZeroElement

tests/test_function.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,8 @@ def f(x: int):
607607
# Redirect `float`s to `int`s.
608608
dispatch.multi((float,))(f.invoke(int))
609609

610-
assert f(1) == int
611-
assert f(1.0) == float
610+
assert f(1) is int
611+
assert f(1.0) is float
612612

613613
assert f.methods[0].implementation is f_orig
614614
assert f.methods[1].implementation is not f_orig

tests/test_method.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def f2(x) -> float:
2525
for _ in range(2):
2626
assert m.function_name == "different_name"
2727
assert m.signature == sig
28-
assert m.return_type == complex
28+
assert m.return_type is complex
2929
assert m.implementation == f
3030

3131
# Test copying.
@@ -79,7 +79,7 @@ def f(x) -> float:
7979

8080
m = Method(f, sig)
8181
assert m.function_name == "f"
82-
assert m.return_type == float
82+
assert m.return_type is float
8383

8484

8585
def test_equality():

tests/test_parametric.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class A(Base1, metaclass=metaclass):
5858
a1 = A[1]()
5959
a2 = A[2]()
6060

61-
assert type(a1) == A[1]
62-
assert type(a2) == A[2]
61+
assert type(a1) is A[1]
62+
assert type(a2) is A[2]
6363
assert isinstance(a1, A[1])
6464
assert not isinstance(a1, A[2])
6565
assert issubclass(type(a1), A)
@@ -157,11 +157,11 @@ def __init__(self, v, w, x, y, z):
157157
assert not issubclass(E[1], D[1, 2])
158158
assert not issubclass(E[1], D[2])
159159

160-
assert type(A(1)) == A
161-
assert type(B(1, 2)) == B[int, int]
162-
assert type(C(1, 2, 3)) == C
163-
assert type(D(1, 2, 3, 4)) == D[int, int, int, int]
164-
assert type(E(1, 2, 3, 4, 5)) == E[int, int, int, int, int]
160+
assert type(A(1)) is A
161+
assert type(B(1, 2)) is B[int, int]
162+
assert type(C(1, 2, 3)) is C
163+
assert type(D(1, 2, 3, 4)) is D[int, int, int, int]
164+
assert type(E(1, 2, 3, 4, 5)) is E[int, int, int, int, int]
165165

166166

167167
def test_parametric_covariance():
@@ -249,7 +249,7 @@ def __init__(self, x, *, y=3):
249249

250250
assert A[float].parametric
251251
assert A[float].concrete
252-
assert A[float].type_parameter == float
252+
assert A[float].type_parameter is float
253253

254254
a1 = A[float](5.0)
255255
a2 = A(5.0)
@@ -259,9 +259,9 @@ def __init__(self, x, *, y=3):
259259
assert a1.y == 3
260260
assert a2.y == 3
261261

262-
assert type_parameter(a1) == float
263-
assert type_parameter(a2) == float
264-
assert type(a1) == type(a2)
262+
assert type_parameter(a1) is float
263+
assert type_parameter(a2) is float
264+
assert type(a1) is type(a2)
265265
assert type(a1).__name__ == type(a2).__name__ == "A[float]"
266266

267267

@@ -547,7 +547,7 @@ def test_val():
547547
(Val[3, 4], Val((3, 4))),
548548
(Val[(3, 4)], Val((3, 4))),
549549
]:
550-
assert type(v) == T
550+
assert type(v) is T
551551
assert T() == v
552552

553553
# Test all checks for numbers of arguments and the like.

tests/test_signature.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_instantiation_copy():
2323
for _ in range(2):
2424
assert s.types == (int, int)
2525
assert s.has_varargs
26-
assert s.varargs == float
26+
assert s.varargs is float
2727
assert s.precedence == 1
2828
assert s.is_faithful
2929

0 commit comments

Comments
 (0)