我们从Python开源项目中,提取了以下11个代码示例,用于说明如何使用enum._make_class_unpicklable()。
def test_exploding_pickle(self): BadPickle = Enum('BadPickle', 'dill sweet bread-n-butter') enum._make_class_unpicklable(BadPickle) globals()['BadPickle'] = BadPickle test_pickle_exception(self.assertRaises, TypeError, BadPickle.dill) test_pickle_exception(self.assertRaises, PicklingError, BadPickle)
def test_exploding_pickle(self): BadPickle = Enum( 'BadPickle', 'dill sweet bread-n-butter', module=__name__) globals()['BadPickle'] = BadPickle # now break BadPickle to test exception raising enum._make_class_unpicklable(BadPickle) test_pickle_exception(self.assertRaises, TypeError, BadPickle.dill) test_pickle_exception(self.assertRaises, PicklingError, BadPickle)