From 0e4701169a3e3a022f03997399d04d28ca90c620 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 1 Feb 2017 10:55:58 -0800 Subject: Issue #29377: Add three new wrappers to types.py (Manuel Krebber). --- Lib/test/test_types.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'Lib/test/test_types.py') diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index 382ca03e5a..4a9fcba526 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -576,6 +576,24 @@ class TypesTests(unittest.TestCase): self.assertGreater(object.__basicsize__, 0) self.assertGreater(tuple.__itemsize__, 0) + def test_slot_wrapper_types(self): + self.assertIsInstance(object.__init__, types.SlotWrapperType) + self.assertIsInstance(object.__str__, types.SlotWrapperType) + self.assertIsInstance(object.__lt__, types.SlotWrapperType) + self.assertIsInstance(int.__lt__, types.SlotWrapperType) + + def test_method_wrapper_types(self): + self.assertIsInstance(object().__init__, types.MethodWrapperType) + self.assertIsInstance(object().__str__, types.MethodWrapperType) + self.assertIsInstance(object().__lt__, types.MethodWrapperType) + self.assertIsInstance((42).__lt__, types.MethodWrapperType) + + def test_method_descriptor_types(self): + self.assertIsInstance(str.join, types.MethodDescriptorType) + self.assertIsInstance(list.append, types.MethodDescriptorType) + self.assertIsInstance(''.join, types.BuiltinMethodType) + self.assertIsInstance([].append, types.BuiltinMethodType) + class MappingProxyTests(unittest.TestCase): mappingproxy = types.MappingProxyType -- cgit v1.2.1