@@ -49,12 +49,12 @@ def get_dummy_application(role: str) -> AppDef:
4949 return AppDef (name = "test_app" , roles = [trainer ])
5050
5151
52- def test_empty_fn () -> AppDef :
52+ def example_empty_fn () -> AppDef :
5353 """Empty function that returns dummy app"""
5454 return get_dummy_application ("trainer" )
5555
5656
57- def test_fn_with_bool (flag : bool = False ) -> AppDef :
57+ def example_fn_with_bool (flag : bool = False ) -> AppDef :
5858 """Dummy app with or without flag
5959
6060 Args:
@@ -66,7 +66,7 @@ def test_fn_with_bool(flag: bool = False) -> AppDef:
6666 return get_dummy_application ("trainer-without-flag" )
6767
6868
69- def test_fn_with_bool_optional (flag : Optional [bool ] = None ) -> AppDef :
69+ def example_fn_with_bool_optional (flag : Optional [bool ] = None ) -> AppDef :
7070 """Dummy app with or without flag
7171
7272 Args:
@@ -78,11 +78,11 @@ def test_fn_with_bool_optional(flag: Optional[bool] = None) -> AppDef:
7878 return get_dummy_application ("trainer-without-flag" )
7979
8080
81- def test_empty_fn_no_docstring () -> AppDef :
81+ def example_empty_fn_no_docstring () -> AppDef :
8282 return get_dummy_application ("trainer" )
8383
8484
85- def _test_complex_fn (
85+ def example_test_complex_fn (
8686 app_name : str ,
8787 containers : List [str ],
8888 roles_scripts : Dict [str , str ],
@@ -133,7 +133,7 @@ def _test_complex_fn(
133133_TEST_VAR_ARGS : Optional [Tuple [object , ...]] = None
134134
135135
136- def _test_var_args (foo : str , * args : str , bar : str = "asdf" ) -> AppDef :
136+ def example_var_args (foo : str , * args : str , bar : str = "asdf" ) -> AppDef :
137137 """
138138 test component for mixing var args with kwargs.
139139 Args:
@@ -149,7 +149,7 @@ def _test_var_args(foo: str, *args: str, bar: str = "asdf") -> AppDef:
149149_TEST_VAR_ARGS_FIRST : Optional [Tuple [object , ...]] = None
150150
151151
152- def _test_var_args_first (* args : str , bar : str = "asdf" ) -> AppDef :
152+ def example_var_args_first (* args : str , bar : str = "asdf" ) -> AppDef :
153153 """
154154 test component for mixing var args with kwargs.
155155 Args:
@@ -164,7 +164,7 @@ def _test_var_args_first(*args: str, bar: str = "asdf") -> AppDef:
164164_TEST_SINGLE_LETTER : Optional [str ] = None
165165
166166
167- def _test_single_letter (c : str ) -> AppDef :
167+ def example_single_letter (c : str ) -> AppDef :
168168 global _TEST_SINGLE_LETTER
169169 _TEST_SINGLE_LETTER = c
170170 return AppDef (name = "varargs" )
@@ -182,7 +182,7 @@ def _get_nested_arg(self) -> Dict[str, List[str]]:
182182
183183 def _get_expected_app_with_default (self ) -> AppDef :
184184 role_args = self ._get_role_args ()
185- return _test_complex_fn (
185+ return example_test_complex_fn (
186186 "test_app" ,
187187 ["img1" , "img2" ],
188188 {"worker" : "worker.py" , "master" : "master.py" },
@@ -209,7 +209,7 @@ def _get_args_with_default(self) -> List[str]:
209209
210210 def _get_expected_app_with_all_args (self ) -> AppDef :
211211 role_args = self ._get_role_args ()
212- return _test_complex_fn (
212+ return example_test_complex_fn (
213213 "test_app" ,
214214 ["img1" , "img2" ],
215215 {"worker" : "worker.py" , "master" : "master.py" },
@@ -245,7 +245,7 @@ def _get_app_args(self) -> List[str]:
245245 def _get_expected_app_with_nested_objects (self ) -> AppDef :
246246 role_args = self ._get_role_args ()
247247 defaults = self ._get_nested_arg ()
248- return _test_complex_fn (
248+ return example_test_complex_fn (
249249 "test_app" ,
250250 ["img1" , "img2" ],
251251 {"worker" : "worker.py" , "master" : "master.py" },
@@ -282,20 +282,20 @@ def _get_app_args_and_defaults_with_nested_objects(
282282 ], defaults
283283
284284 def test_load_from_fn_empty (self ) -> None :
285- actual_app = materialize_appdef (test_empty_fn , [])
285+ actual_app = materialize_appdef (example_empty_fn , [])
286286 expected_app = get_dummy_application ("trainer" )
287287 self .assert_apps (expected_app , actual_app )
288288
289289 def test_load_from_fn_complex_all_args (self ) -> None :
290290 expected_app = self ._get_expected_app_with_all_args ()
291291 app_args = self ._get_app_args ()
292- actual_app = materialize_appdef (_test_complex_fn , app_args )
292+ actual_app = materialize_appdef (example_test_complex_fn , app_args )
293293 self .assert_apps (expected_app , actual_app )
294294
295295 def test_required_args (self ) -> None :
296296 with patch .object (sys , "exit" ) as exit_mock :
297297 try :
298- materialize_appdef (_test_complex_fn , [])
298+ materialize_appdef (example_test_complex_fn , [])
299299 except Exception :
300300 # ignore any errors, since function should fail
301301 pass
@@ -304,18 +304,18 @@ def test_required_args(self) -> None:
304304 def test_load_from_fn_with_default (self ) -> None :
305305 expected_app = self ._get_expected_app_with_default ()
306306 app_args = self ._get_args_with_default ()
307- actual_app = materialize_appdef (_test_complex_fn , app_args )
307+ actual_app = materialize_appdef (example_test_complex_fn , app_args )
308308 self .assert_apps (expected_app , actual_app )
309309
310310 def test_with_nested_object (self ) -> None :
311311 expected_app = self ._get_expected_app_with_nested_objects ()
312312 app_args , defaults = self ._get_app_args_and_defaults_with_nested_objects ()
313- actual_app = materialize_appdef (_test_complex_fn , app_args , defaults )
313+ actual_app = materialize_appdef (example_test_complex_fn , app_args , defaults )
314314 self .assert_apps (expected_app , actual_app )
315315
316316 def test_varargs (self ) -> None :
317317 materialize_appdef (
318- _test_var_args ,
318+ example_var_args ,
319319 [
320320 "--foo" ,
321321 "fooval" ,
@@ -329,15 +329,15 @@ def test_varargs(self) -> None:
329329
330330 def test_bool_true (self ) -> None :
331331 app_def = materialize_appdef (
332- test_fn_with_bool ,
332+ example_fn_with_bool ,
333333 [
334334 "--flag" ,
335335 "True" ,
336336 ],
337337 )
338338 self .assertEqual ("trainer-with-flag" , app_def .roles [0 ].name )
339339 app_def = materialize_appdef (
340- test_fn_with_bool ,
340+ example_fn_with_bool ,
341341 [
342342 "--flag" ,
343343 "true" ,
@@ -347,15 +347,15 @@ def test_bool_true(self) -> None:
347347
348348 def test_bool_false (self ) -> None :
349349 app_def = materialize_appdef (
350- test_fn_with_bool ,
350+ example_fn_with_bool ,
351351 [
352352 "--flag" ,
353353 "False" ,
354354 ],
355355 )
356356 self .assertEqual ("trainer-without-flag" , app_def .roles [0 ].name )
357357 app_def = materialize_appdef (
358- test_fn_with_bool ,
358+ example_fn_with_bool ,
359359 [
360360 "--flag" ,
361361 "false" ,
@@ -365,14 +365,14 @@ def test_bool_false(self) -> None:
365365
366366 def test_bool_none (self ) -> None :
367367 app_def = materialize_appdef (
368- test_fn_with_bool_optional ,
368+ example_fn_with_bool_optional ,
369369 [],
370370 )
371371 self .assertEqual ("trainer-without-flag" , app_def .roles [0 ].name )
372372
373373 def test_varargs_only_flag_first (self ) -> None :
374374 materialize_appdef (
375- _test_var_args_first ,
375+ example_var_args_first ,
376376 [
377377 "--" ,
378378 "--foo" ,
@@ -389,7 +389,7 @@ def test_varargs_only_flag_first(self) -> None:
389389
390390 def test_varargs_only_arg_first (self ) -> None :
391391 materialize_appdef (
392- _test_var_args_first ,
392+ example_var_args_first ,
393393 [
394394 "fooval" ,
395395 "--foo" ,
@@ -405,7 +405,7 @@ def test_varargs_only_arg_first(self) -> None:
405405
406406 def test_single_letter (self ) -> None :
407407 materialize_appdef (
408- _test_single_letter ,
408+ example_single_letter ,
409409 [
410410 "-c" ,
411411 "arg1" ,
@@ -417,7 +417,7 @@ def test_single_letter(self) -> None:
417417 )
418418
419419 materialize_appdef (
420- _test_single_letter ,
420+ example_single_letter ,
421421 [
422422 "--c" ,
423423 "arg2" ,
@@ -439,7 +439,7 @@ def _get_argument_help(
439439 return None
440440
441441 def test_argparster_complex_fn_partial (self ) -> None :
442- parser = _create_args_parser (_test_complex_fn )
442+ parser = _create_args_parser (example_test_complex_fn )
443443 self .assertTupleEqual (
444444 ("AppDef name" , None ),
445445 none_throws (self ._get_argument_help (parser , "app_name" )),
@@ -469,10 +469,10 @@ def test_argparster_complex_fn_partial(self) -> None:
469469 )
470470
471471 def test_argparser_remainder_main_args (self ) -> None :
472- parser = _create_args_parser (_test_complex_fn )
472+ parser = _create_args_parser (example_test_complex_fn )
473473
474474 materialize_appdef (
475- _test_var_args ,
475+ example_var_args ,
476476 [
477477 "--foo" ,
478478 "fooval" ,
@@ -486,7 +486,7 @@ def test_argparser_remainder_main_args(self) -> None:
486486 self .assertEqual (_TEST_VAR_ARGS , ("fooval" , ("arg1" , "arg2" ), "barval" ))
487487
488488 materialize_appdef (
489- _test_var_args ,
489+ example_var_args ,
490490 [
491491 "--foo" ,
492492 "fooval" ,
0 commit comments