def test_delattr(self): import sys sys.spam = 1 delattr(sys, 'spam') self.assertRaises(TypeError, delattr)