diff --git a/tensorflow/tools/docs/doc_controls_test.py b/tensorflow/tools/docs/doc_controls_test.py index 410342fb69f..d5eb4ffc000 100644 --- a/tensorflow/tools/docs/doc_controls_test.py +++ b/tensorflow/tools/docs/doc_controls_test.py @@ -145,7 +145,7 @@ class DocControlsTest(googletest.TestCase): self.assertTrue( doc_controls.should_skip_class_attr(GrandChild, 'my_method')) - def testfor_subclass_implementers(self): + def test_for_subclass_implementers(self): class GrandParent(object): @@ -178,6 +178,43 @@ class DocControlsTest(googletest.TestCase): self.assertTrue( doc_controls.should_skip_class_attr(Grand2Child, 'my_method')) + def test_for_subclass_implementers_short_circuit(self): + + class GrandParent(object): + + @doc_controls.for_subclass_implementers + def my_method(self): + pass + + class Parent(GrandParent): + + def my_method(self): + pass + + class Child(Parent): + + @doc_controls.do_not_doc_inheritable + def my_method(self): + pass + + class GrandChild(Child): + + @doc_controls.for_subclass_implementers + def my_method(self): + pass + + class Grand2Child(Child): + pass + + self.assertFalse( + doc_controls.should_skip_class_attr(GrandParent, 'my_method')) + self.assertTrue(doc_controls.should_skip_class_attr(Parent, 'my_method')) + self.assertTrue(doc_controls.should_skip_class_attr(Child, 'my_method')) + self.assertFalse( + doc_controls.should_skip_class_attr(GrandChild, 'my_method')) + self.assertTrue( + doc_controls.should_skip_class_attr(Grand2Child, 'my_method')) + if __name__ == '__main__': googletest.main()