📜  python assertRaises 与类属性 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:52.251000             🧑  作者: Mango

代码示例1
from unittest import TestCase

class MyTest(TestCase):
    def test_property(self):
        # Test that Type Error is correctly raised
        obj = MyClass("foobar")
        self.assertRaises(TypeError, lambda: x.my_property, obj)