make the types of None and Ellipsis callable

This commit is contained in:
Benjamin Peterson 2011-07-29 18:19:43 -05:00
parent 4f921c2e06
commit c4607aeedd
4 changed files with 73 additions and 0 deletions

View file

@ -1343,6 +1343,13 @@ class BuiltinTest(unittest.TestCase):
self.assertRaises(ValueError, x.translate, b"1", 1)
self.assertRaises(TypeError, x.translate, b"1"*256, 1)
def test_construct_singletons(self):
for const in None, Ellipsis:
tp = type(const)
self.assertIs(tp(), const)
self.assertRaises(TypeError, tp, 1, 2)
self.assertRaises(TypeError, tp, a=1, b=2)
class TestSorted(unittest.TestCase):
def test_basic(self):