From 7f7a67aac8667539abef73cec6ad763b9b0f97b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Fri, 7 Jun 2013 22:25:27 +0200 Subject: [PATCH] Fixed #18150: duplicate test inside TestSingleDispatch Thanks to Vajrasky Kok for the patch --- Lib/test/test_functools.py | 33 ++++++++++++++------------------- Misc/ACKS | 1 + 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index a6b1e03ad7e..49c807d0592 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -868,29 +868,24 @@ class TestSingleDispatch(unittest.TestCase): @functools.singledispatch def g(obj): return "base" - class C: + class A: pass - class D(C): + class C(A): pass - def g_C(c): - return "C" - g.register(C, g_C) - self.assertEqual(g(C()), "C") - self.assertEqual(g(D()), "C") - - def test_classic_classes(self): - @functools.singledispatch - def g(obj): - return "base" - class C: + class B(A): pass - class D(C): + class D(C, B): pass - def g_C(c): - return "C" - g.register(C, g_C) - self.assertEqual(g(C()), "C") - self.assertEqual(g(D()), "C") + def g_A(a): + return "A" + def g_B(b): + return "B" + g.register(A, g_A) + g.register(B, g_B) + self.assertEqual(g(A()), "A") + self.assertEqual(g(B()), "B") + self.assertEqual(g(C()), "A") + self.assertEqual(g(D()), "B") def test_register_decorator(self): @functools.singledispatch diff --git a/Misc/ACKS b/Misc/ACKS index 3ce5cd20561..754500d6714 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -666,6 +666,7 @@ Kubilay Kocak Greg Kochanski Damon Kohler Marko Kohtala +Vajrasky Kok Guido Kollerie Jacek Konieczny Марк Коренберг