Skip to content

Commit

Permalink
test for initializing dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
elliesch committed Mar 6, 2024
1 parent b7d3aea commit bc5bb85
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions flipnslide/tests/test_dataset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
''' Test dataset.py '''

import pytest
import torch
from ..dataset import TiledDataset, TileDataset



# Create sample data
tiles = [torch.randn(10, 10) for _ in range(100)]
permute_idx = torch.randint(0, 5, (100,))
batch_size = 10

def test_TiledDataset():

# Test if TiledDataset initializes properly
dataset = TiledDataset(tiles, permute_idx, batch_size=batch_size)

assert len(dataset.train_dataset) > 0
assert len(dataset.test_dataset) > 0
assert isinstance(dataset.dataloader, torch.utils.data.DataLoader)

0 comments on commit bc5bb85

Please sign in to comment.