We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bc262de commit 6c6e8b8Copy full SHA for 6c6e8b8
Lib/test/test_functools.py
@@ -3228,6 +3228,25 @@ def f(arg):
3228
def _(arg: undefined):
3229
return "forward reference"
3230
3231
+ def test_singledispatchmethod_hash_comparision_equal(self):
3232
+ from dataclasses import dataclass
3233
+
3234
+ @dataclass(frozen=True)
3235
+ class A:
3236
+ value: int
3237
3238
+ @functools.singledispatchmethod
3239
+ def dispatch(self, x):
3240
+ return id(self)
3241
3242
+ t1 = A(1)
3243
+ t2 = A(1)
3244
3245
+ assert t1 == t2
3246
+ assert id(t1) == t1.dispatch(2)
3247
+ assert id(t2) == t2.dispatch(2) # gh-127750
3248
3249
3250
class CachedCostItem:
3251
_cost = 1
3252
0 commit comments