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

Method test_write

tensorflow/tools/docs/generate_lib_test.py:105–146  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

103 return reference_resolver, parser_config
104
105 def test_write(self):
106 _, parser_config = self.get_test_objects()
107
108 output_dir = googletest.GetTempDir()
109
110 generate_lib.write_docs(output_dir, parser_config, yaml_toc=True,
111 site_api_path='api_docs/python')
112
113 # Check redirects
114 redirects_file = os.path.join(output_dir, '_redirects.yaml')
115 self.assertTrue(os.path.exists(redirects_file))
116 with open(redirects_file) as f:
117 redirects = f.read()
118 self.assertEqual(redirects.split(), [
119 'redirects:', '-', 'from:', '/api_docs/python/tf/test_function', 'to:',
120 '/api_docs/python/tf/TestModule/test_function'
121 ])
122
123 # Make sure that the right files are written to disk.
124 self.assertTrue(os.path.exists(os.path.join(output_dir, 'index.md')))
125 self.assertTrue(os.path.exists(os.path.join(output_dir, 'tf.md')))
126 self.assertTrue(os.path.exists(os.path.join(output_dir, '_toc.yaml')))
127 self.assertTrue(
128 os.path.exists(os.path.join(output_dir, 'tf/TestModule.md')))
129 self.assertFalse(
130 os.path.exists(os.path.join(output_dir, 'tf/test_function.md')))
131 self.assertTrue(
132 os.path.exists(
133 os.path.join(output_dir, 'tf/TestModule/TestClass.md')))
134 self.assertTrue(
135 os.path.exists(
136 os.path.join(output_dir,
137 'tf/TestModule/TestClass/ChildClass.md')))
138 self.assertTrue(
139 os.path.exists(
140 os.path.join(
141 output_dir,
142 'tf/TestModule/TestClass/ChildClass/GrandChildClass.md')))
143 # Make sure that duplicates are not written
144 self.assertTrue(
145 os.path.exists(
146 os.path.join(output_dir, 'tf/TestModule/test_function.md')))
147
148 def test_update_id_tags_inplace(self):
149 test_dir = googletest.GetTempDir()

Callers

nothing calls this directly

Calls 4

get_test_objectsMethod · 0.95
joinMethod · 0.45
readMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected