MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / test_generate_index

Method test_generate_index

tensorflow/tools/docs/parser_test.py:535–566  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

533 'NumPy has nothing as awesome as this function.\n')
534
535 def test_generate_index(self):
536
537 index = {
538 'tf': test_module,
539 'tf.TestModule': test_module,
540 'tf.test_function': test_function,
541 'tf.TestModule.test_function': test_function,
542 'tf.TestModule.TestClass': TestClass,
543 'tf.TestModule.TestClass.a_method': TestClass.a_method,
544 'tf.TestModule.TestClass.a_property': TestClass.a_property,
545 'tf.TestModule.TestClass.ChildClass': TestClass.ChildClass,
546 }
547 duplicate_of = {'tf.TestModule.test_function': 'tf.test_function'}
548
549 visitor = DummyVisitor(index=index, duplicate_of=duplicate_of)
550
551 reference_resolver = parser.ReferenceResolver.from_visitor(
552 visitor=visitor, doc_index={}, py_module_names=['tf'])
553
554 docs = parser.generate_global_index('TestLibrary', index=index,
555 reference_resolver=reference_resolver)
556
557 # Make sure duplicates and non-top-level symbols are in the index, but
558 # methods and properties are not.
559 self.assertNotIn('a_method', docs)
560 self.assertNotIn('a_property', docs)
561 self.assertIn('TestModule.TestClass', docs)
562 self.assertIn('TestModule.TestClass.ChildClass', docs)
563 self.assertIn('TestModule.test_function', docs)
564 # Leading backtick to make sure it's included top-level.
565 # This depends on formatting, but should be stable.
566 self.assertIn('<code>tf.test_function', docs)
567
568 def test_argspec_for_functools_partial(self):
569 # pylint: disable=unused-argument

Callers

nothing calls this directly

Calls 2

from_visitorMethod · 0.80
DummyVisitorClass · 0.70

Tested by

no test coverage detected