return _inspect.getsource(tf_decorator.unwrap(object)[1])
+def isbuiltin(object): # pylint: disable=redefined-builtin
+ """TFDecorator-aware replacement for inspect.isbuiltin."""
+ return _inspect.isbuiltin(tf_decorator.unwrap(object)[1])
+
+
def isclass(object): # pylint: disable=redefined-builtin
"""TFDecorator-aware replacement for inspect.isclass."""
return _inspect.isclass(tf_decorator.unwrap(object)[1])
self.assertEqual(
expected, tf_inspect.getsource(test_decorated_function_with_defaults))
+ def testIsBuiltin(self):
+ self.assertEqual(
+ tf_inspect.isbuiltin(TestDecoratedClass),
+ inspect.isbuiltin(TestDecoratedClass))
+ self.assertEqual(
+ tf_inspect.isbuiltin(test_decorated_function),
+ inspect.isbuiltin(test_decorated_function))
+ self.assertEqual(
+ tf_inspect.isbuiltin(test_undecorated_function),
+ inspect.isbuiltin(test_undecorated_function))
+ self.assertEqual(tf_inspect.isbuiltin(range), inspect.isbuiltin(range))
+ self.assertEqual(tf_inspect.isbuiltin(max), inspect.isbuiltin(max))
+
def testIsClass(self):
self.assertTrue(tf_inspect.isclass(TestDecoratedClass))
self.assertFalse(tf_inspect.isclass(test_decorated_function))