Fixed #18150: duplicate test inside TestSingleDispatch

Thanks to Vajrasky Kok for the patch
This commit is contained in:
Łukasz Langa 2013-06-07 22:25:27 +02:00
parent 997487d5d7
commit 7f7a67aac8
2 changed files with 15 additions and 19 deletions

View File

@ -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

View File

@ -666,6 +666,7 @@ Kubilay Kocak
Greg Kochanski
Damon Kohler
Marko Kohtala
Vajrasky Kok
Guido Kollerie
Jacek Konieczny
Марк Коренберг