我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用inspect.rst()。
def test_sixteen(self): count = len([x for x in dir(inspect) if x.startswith('is')]) # This test is here for remember you to update Doc/library/inspect.rst # which claims there are 16 such functions expected = 16 err_msg = "There are %d (not %d) is* functions" % (count, expected) self.assertEqual(count, expected, err_msg)
def test_sixteen(self): count = len(filter(lambda x:x.startswith('is'), dir(inspect))) # This test is here for remember you to update Doc/library/inspect.rst # which claims there are 16 such functions expected = 16 err_msg = "There are %d (not %d) is* functions" % (count, expected) self.assertEqual(count, expected, err_msg)