Skip to content

Commit

Permalink
Add classification dataset view tests for HDF5
Browse files Browse the repository at this point in the history
  • Loading branch information
gheinrich committed Sep 17, 2015
1 parent 04ca476 commit 56aa184
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions digits/dataset/images/classification/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class BaseViewsTestWithImageset(BaseViewsTest):
IMAGE_HEIGHT = 10
IMAGE_WIDTH = 10
IMAGE_CHANNELS = 3
BACKEND = 'lmdb'
COMPRESSION = 'none'

UNBALANCED_CATEGORY = False

Expand Down Expand Up @@ -103,6 +105,8 @@ def create_dataset(cls, **kwargs):
'resize_channels': cls.IMAGE_CHANNELS,
'resize_width': cls.IMAGE_WIDTH,
'resize_height': cls.IMAGE_HEIGHT,
'backend': cls.BACKEND,
'compression': cls.COMPRESSION,
}
data.update(kwargs)

Expand Down Expand Up @@ -423,6 +427,11 @@ def test_edit_notes(self):
)
assert status == 200, 'failed with %s' % status

def test_backend_selection(self):
rv = self.app.get('/datasets/%s.json' % self.dataset_id)
content = json.loads(rv.data)
for task in content['CreateDbTasks']:
assert task['backend'] == self.BACKEND

class TestCreatedGrayscale(TestCreated):
IMAGE_CHANNELS = 1
Expand All @@ -433,3 +442,16 @@ class TestCreatedWide(TestCreated):
class TestCreatedTall(TestCreated):
IMAGE_HEIGHT = 20

class TestCreatedHdf5(TestCreated):
BACKEND = 'hdf5'

def test_compression_method(self):
rv = self.app.get('/datasets/%s.json' % self.dataset_id)
content = json.loads(rv.data)
for task in content['CreateDbTasks']:
assert task['compression'] == self.COMPRESSION

class TestCreatedHdf5Gzip(TestCreatedHdf5):
COMPRESSION = 'gzip'


0 comments on commit 56aa184

Please sign in to comment.