Adive01 commited on
Commit
1cd79e1
·
verified ·
1 Parent(s): 9237ef1

Upload tests/test_eval.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. tests/test_eval.py +17 -0
tests/test_eval.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+ import numpy as np
3
+ from mlplo.eval import maybe_limit_split
4
+
5
+ def test_maybe_limit_split():
6
+ class DummyDataset:
7
+ def __init__(self, size):
8
+ self.size = size
9
+ def __len__(self):
10
+ return self.size
11
+ def select(self, indices):
12
+ return list(indices)
13
+
14
+ ds = DummyDataset(10)
15
+ assert maybe_limit_split(ds, None) == ds
16
+ assert maybe_limit_split(ds, 15) == ds
17
+ assert maybe_limit_split(ds, 5) == list(range(5))