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

Method test_parse_md_docstring

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

Source from the content-addressed store, hash-verified

469 page_info.signature)
470
471 def test_parse_md_docstring(self):
472
473 def test_function_with_fancy_docstring(arg):
474 """Function with a fancy docstring.
475
476 And a bunch of references: @{tf.reference}, another @{tf.reference},
477 a member @{tf.reference.foo}, and a @{tf.third}.
478
479 Args:
480 arg: An argument.
481
482 Raises:
483 an exception
484
485 Returns:
486 arg: the input, and
487 arg: the input, again.
488
489 @compatibility(numpy)
490 NumPy has nothing as awesome as this function.
491 @end_compatibility
492
493 @compatibility(theano)
494 Theano has nothing as awesome as this function.
495
496 Check it out.
497 @end_compatibility
498
499 """
500 return arg, arg
501
502 class HasOneMember(object):
503
504 def foo(self):
505 pass
506
507 duplicate_of = {'tf.third': 'tf.fourth'}
508 index = {
509 'tf': test_module,
510 'tf.fancy': test_function_with_fancy_docstring,
511 'tf.reference': HasOneMember,
512 'tf.reference.foo': HasOneMember.foo,
513 'tf.third': HasOneMember,
514 'tf.fourth': HasOneMember
515 }
516
517 visitor = DummyVisitor(index=index, duplicate_of=duplicate_of)
518
519 reference_resolver = parser.ReferenceResolver.from_visitor(
520 visitor=visitor, doc_index={}, py_module_names=['tf'])
521
522 doc_info = parser._parse_md_docstring(test_function_with_fancy_docstring,
523 '../..', reference_resolver)
524
525 self.assertNotIn('@', doc_info.docstring)
526 self.assertNotIn('compatibility', doc_info.docstring)
527 self.assertNotIn('Raises:', doc_info.docstring)
528

Callers

nothing calls this directly

Calls 3

from_visitorMethod · 0.80
DummyVisitorClass · 0.70
keysMethod · 0.45

Tested by

no test coverage detected