Generates documentation for fastai's functional tests
from fastai.gen_doc.nbdoc import *
from fastai.gen_doc.nbtest import *
show_test
and doctest
searches for any implemented tests for a given fastai class or function
For test writers:
For fastai users:
nbdoc.show_doc
and nbdoc.doc
.show_doc(show_test)
show_test
[source][test]
show_test
(elt
) →str
No tests found for show_test
. To contribute a test please refer to this guide and this discussion.
Show associated tests for a fastai function/class
Show tests from function
from fastai.basic_train import Learner
show_test(Learner.fit)
Show tests from a Class
from fastai.basic_data import DataBunch
show_test(DataBunch)
Tests found for DataBunch
:
pytest -sv tests/test_data_block.py::test_custom_dataset
[source]Some other tests where DataBunch
is used:
pytest -sv tests/test_basic_data.py::test_DataBunch_Create
[source]pytest -sv tests/test_basic_data.py::test_DataBunch_no_valid_dl
[source]pytest -sv tests/test_basic_data.py::test_DataBunch_save_load
[source]To run tests please refer to this guide.
from fastai.text.data import TextList
show_test(TextList)
Above, you will see 2 different test types: Tests found for...
and Some other tests...
Tests found for...
- Searches for function matches in test_registry.json
. This json file is populated from doctest.this_tests
calls.Some other tests...
- Returns any test function where the fastai function in called inside the bodyshow_doc(doctest)
show_doc(lookup_db)
lookup_db
[source][test]
lookup_db
(elt
) →List
[Dict
[KT
,VT
]]
No tests found for lookup_db
. To contribute a test please refer to this guide and this discussion.
Finds this_test
entries from test_registry.json
show_doc(find_related_tests)
show_doc(find_test_matches)
find_test_matches
[source][test]
find_test_matches
(elt
,test_file
:Path
) →Tuple
[List
[Dict
[KT
,VT
]],List
[Dict
[KT
,VT
]]]
No tests found for find_test_matches
. To contribute a test please refer to this guide and this discussion.
Find all functions in test_file
related to elt
show_doc(find_test_files)
find_test_files
[source][test]
find_test_files
(elt
,exact_match
:bool
=*False
*) →List
[Path
]
No tests found for find_test_files
. To contribute a test please refer to this guide and this discussion.
Searches in fastai/tests
directory for module tests
show_doc(fuzzy_test_match)
fuzzy_test_match
[source][test]
fuzzy_test_match
(fn_name
:str
,lines
:List
[Dict
[KT
,VT
]],rel_path
:str
) →List
[TestFunctionMatch
]
Find any lines where fn_name
is invoked and return the parent test function