diff options
author | Zachary Ware <zachary.ware@gmail.com> | 2013-12-08 06:44:27 (GMT) |
---|---|---|
committer | Zachary Ware <zachary.ware@gmail.com> | 2013-12-08 06:44:27 (GMT) |
commit | 101d9e7250c039aeabea1582459d40b52cc81024 (patch) | |
tree | e0a6990c763c2435fae0a08a4114ac17569aa261 /Lib/test/test_functools.py | |
parent | 5ca129b8f016668bf914592e58082c452a7ad9b4 (diff) | |
parent | 7ef00ff91a0a90a2b11df40d110365e6a7909a94 (diff) | |
download | cpython-101d9e7250c039aeabea1582459d40b52cc81024.zip cpython-101d9e7250c039aeabea1582459d40b52cc81024.tar.gz cpython-101d9e7250c039aeabea1582459d40b52cc81024.tar.bz2 |
Issue 19572: More silently skipped tests explicitly skipped.
Diffstat (limited to 'Lib/test/test_functools.py')
-rw-r--r-- | Lib/test/test_functools.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py index 38c9713..d044237 100644 --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -42,20 +42,6 @@ class TestPartial: self.assertEqual(p.func, capture) self.assertEqual(p.args, (1, 2)) self.assertEqual(p.keywords, dict(a=10, b=20)) - # attributes should not be writable - if not isinstance(self.partial, type): - return - self.assertRaises(AttributeError, setattr, p, 'func', map) - self.assertRaises(AttributeError, setattr, p, 'args', (1, 2)) - self.assertRaises(AttributeError, setattr, p, 'keywords', dict(a=1, b=2)) - - p = self.partial(hex) - try: - del p.__dict__ - except TypeError: - pass - else: - self.fail('partial object allowed __dict__ to be deleted') def test_argument_checking(self): self.assertRaises(TypeError, self.partial) # need at least a func arg @@ -151,6 +137,21 @@ class TestPartialC(TestPartial, unittest.TestCase): if c_functools: partial = c_functools.partial + def test_attributes_unwritable(self): + # attributes should not be writable + p = self.partial(capture, 1, 2, a=10, b=20) + self.assertRaises(AttributeError, setattr, p, 'func', map) + self.assertRaises(AttributeError, setattr, p, 'args', (1, 2)) + self.assertRaises(AttributeError, setattr, p, 'keywords', dict(a=1, b=2)) + + p = self.partial(hex) + try: + del p.__dict__ + except TypeError: + pass + else: + self.fail('partial object allowed __dict__ to be deleted') + def test_repr(self): args = (object(), object()) args_repr = ', '.join(repr(a) for a in args) |