[Python-checkins] cpython: Fixed #18150: duplicate test inside TestSingleDispatch

lukasz.langa python-checkins at python.org
Fri Jun 7 22:26:31 CEST 2013


http://hg.python.org/cpython/rev/a16bebe653b1
changeset:   84053:a16bebe653b1
user:        Łukasz Langa <lukasz at langa.pl>
date:        Fri Jun 07 22:25:27 2013 +0200
summary:
  Fixed #18150: duplicate test inside TestSingleDispatch

Thanks to Vajrasky Kok for the patch

files:
  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
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -868,29 +868,24 @@
         @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
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -666,6 +666,7 @@
 Greg Kochanski
 Damon Kohler
 Marko Kohtala
+Vajrasky Kok
 Guido Kollerie
 Jacek Konieczny
 Марк Коренберг

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list