| 7 | class TestFastAI(unittest.TestCase): |
| 8 | # Basic import |
| 9 | def test_basic(self): |
| 10 | import fastai |
| 11 | import fastcore |
| 12 | import fastprogress |
| 13 | import fastdownload |
| 14 | |
| 15 | def test_has_version(self): |
| 16 | self.assertGreater(len(fastai.__version__), 2) |
| 17 | |
| 18 | # based on https://github.com/fastai/fastai/blob/master/tests/test_torch_core.py#L17 |
| 19 | def test_torch_tensor(self): |
| 20 | a = tensor([1, 2, 3]) |
| 21 | b = torch.tensor([1, 2, 3]) |
| 22 | |
| 23 | self.assertTrue(torch.all(a == b)) |
| 24 | |
| 25 | def test_tabular(self): |
| 26 | dls = TabularDataLoaders.from_csv( |
| 27 | "/input/tests/data/train.csv", |
| 28 | cont_names=["pixel" + str(i) for i in range(784)], |
| 29 | y_names="label", |
| 30 | procs=[FillMissing, Categorify, Normalize], |
| 31 | ) |
| 32 | learn = tabular_learner(dls, layers=[200, 100]) |
| 33 | with learn.no_bar(): |
| 34 | learn.fit_one_cycle(n_epoch=1) |
| 35 | |
| 36 | self.assertGreater(learn.smooth_loss, 0) |
nothing calls this directly
no outgoing calls
no test coverage detected