diff options
| author | Yury Selivanov <yselivanov@sprymix.com> | 2015-08-18 18:30:15 (GMT) |
|---|---|---|
| committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-08-18 18:30:15 (GMT) |
| commit | ab7cc7598a3b8fd3bfb8c21412ac693ba8e9396a (patch) | |
| tree | cbb1af1372b9ec5587b51820d2f86490e8ad161c /Lib/test/test_functools.py | |
| parent | a78ebe63239eb665ae139cf8155108af16b26b64 (diff) | |
| download | cpython-ab7cc7598a3b8fd3bfb8c21412ac693ba8e9396a.zip cpython-ab7cc7598a3b8fd3bfb8c21412ac693ba8e9396a.tar.gz cpython-ab7cc7598a3b8fd3bfb8c21412ac693ba8e9396a.tar.bz2 | |
Issue #23572: Fixed functools.singledispatch on classes with falsy metaclasses.
Patch by Ethan Furman.
Diffstat (limited to 'Lib/test/test_functools.py')
| -rw-r--r-- | Lib/test/test_functools.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index 36f154a..c0d24d8c 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1328,6 +1328,24 @@ class TestSingleDispatch(unittest.TestCase): many_abcs = [c.Mapping, c.Sized, c.Callable, c.Container, c.Iterable] self.assertEqual(mro(X, abcs=many_abcs), expected) + def test_false_meta(self): + # see issue23572 + class MetaA(type): + def __len__(self): + return 0 + class A(metaclass=MetaA): + pass + class AA(A): + pass + @functools.singledispatch + def fun(a): + return 'base A' + @fun.register(A) + def _(a): + return 'fun A' + aa = AA() + self.assertEqual(fun(aa), 'fun A') + def test_mro_conflicts(self): c = collections @functools.singledispatch |
