def test_link_class_methods(): docstr = "To train your model in mixed precision you just have to call `Learner.to_fp16`, which converts the model and modifies the existing `Learner` to add `MixedPrecision`." expected = "To train your model in mixed precision you just have to call [`Learner.to_fp16`](/train.html#to_fp16), which converts the model and modifies the existing [`Learner`](/basic_train.html#Learner) to add [`MixedPrecision`](/callbacks.fp16.html#MixedPrecision)." imports = 'from fastai.callbacks.fp16 import *' assert_link(docstr, expected, nb_cells=[gen_notebooks.get_code_cell(imports)])
def test_link_class_methods(): docstr = "`ImageDataBunch.from_csv`" expected = "[`ImageDataBunch.from_csv`](/vision.data.html#ImageDataBunch.from_csv)" imports = 'from fastai.vision.data import *' assert_link(docstr, expected, nb_cells=[gen_notebooks.get_code_cell(imports)])
def test_class_anchor(): docstr = "`DataBunch.create`, `DeviceDataLoader.proc_batch`" expected = "[`DataBunch.create`](/basic_data.html#DataBunch.create), [`DeviceDataLoader.proc_batch`](/basic_data.html#DeviceDataLoader.proc_batch)" imports = 'from fastai.basic_train import *' assert_link(docstr, expected, nb_cells=[gen_notebooks.get_code_cell(imports)])
def test_link_vision_learner_priority(): # Edge case for vision.learner.ipynb imports = """from fastai.gen_doc.nbdoc import * from fastai.vision import * from fastai import * """ docstr = "Pass in your `data`, calculated `preds`, actual `y`," expected = "Pass in your [`data`](/vision.data#vision.data), calculated `preds`, actual `y`," err_msg = "`data` should link to vision.data instead of text.data." modules = gen_notebooks.get_imported_modules([gen_notebooks.get_code_cell(imports)], nb_module_name='fastai.vision.learner') assert_link(docstr, expected, modules=modules, msg=err_msg)