@@ -184,68 +184,6 @@ def test_write(self):
184
184
# Make sure that duplicates are not written
185
185
self .assertTrue ((output_dir / 'tf/TestModule/test_function.md' ).exists ())
186
186
187
- def test_replace_refes (self ):
188
- test_dir = self .workdir
189
- test_in_dir = os .path .join (test_dir , 'in' )
190
- test_in_dir_a = os .path .join (test_dir , 'in/a' )
191
- test_in_dir_b = os .path .join (test_dir , 'in/b' )
192
- os .makedirs (test_in_dir )
193
- os .makedirs (test_in_dir_a )
194
- os .makedirs (test_in_dir_b )
195
-
196
- test_out_dir = os .path .join (test_dir , 'out' )
197
- os .makedirs (test_out_dir )
198
-
199
- test_path1 = os .path .join (test_in_dir_a , 'file1.md' )
200
- test_path2 = os .path .join (test_in_dir_b , 'file2.md' )
201
- test_path3 = os .path .join (test_in_dir_b , 'file3.notmd' )
202
- test_path4 = os .path .join (test_in_dir_b , 'OWNERS' )
203
-
204
- with open (test_path1 , 'w' ) as f :
205
- f .write ('Use `tf.test_function` to test things.' )
206
-
207
- with open (test_path2 , 'w' ) as f :
208
- f .write ('Use `tf.TestModule.TestClass.ChildClass` to test things.\n '
209
- "`tf.whatever` doesn't exist" )
210
-
211
- with open (test_path3 , 'w' ) as f :
212
- file3_content = (
213
- 'Not a .md file. Should be copied unchanged:'
214
- '`tf.TestModule.TestClass.ChildClass`, `tf.test_function`' )
215
- f .write (file3_content )
216
-
217
- with open (test_path4 , 'w' ) as f :
218
- f .write ('' )
219
-
220
- reference_resolver , _ = self .get_test_objects ()
221
- generate_lib .replace_refs (test_in_dir , test_out_dir , [reference_resolver ],
222
- '*.md' )
223
-
224
- with open (os .path .join (test_out_dir , 'a/file1.md' )) as f :
225
- content = f .read ()
226
- self .assertEqual (
227
- content ,
228
- 'Use <a href="api_docs/python/tf/TestModule/test_function.md">'
229
- '<code>tf.test_function</code></a> to test things.\n ' )
230
-
231
- with open (os .path .join (test_out_dir , 'b/file2.md' )) as f :
232
- content = f .read ()
233
- self .assertEqual (
234
- content , 'Use '
235
- '<a href="api_docs/python/tf/TestModule/TestClass/ChildClass.md">'
236
- '<code>tf.TestModule.TestClass.ChildClass</code></a> '
237
- 'to test things.\n '
238
- '`tf.whatever` doesn\' t exist\n ' )
239
-
240
- with open (os .path .join (test_out_dir , 'b/file3.notmd' )) as f :
241
- content = f .read ()
242
- self .assertEqual (content , file3_content )
243
-
244
- with self .assertRaises (IOError ):
245
- # This should fail. The OWNERS file should not be copied
246
- with open (os .path .join (test_out_dir , 'b/OWNERS' )) as f :
247
- content = f .read ()
248
-
249
187
def _get_test_page_info (self ):
250
188
page_info = parser .FunctionPageInfo (
251
189
full_name = 'abc' , py_object = test_function )
0 commit comments