Skip to content

Commit

Permalink
Tests for pad_by_shape
Browse files Browse the repository at this point in the history
  • Loading branch information
JorisVincent committed Nov 6, 2022
1 parent 65f60fe commit a348153
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_pad.py
@@ -0,0 +1,21 @@
import numpy as np
import pytest

from stimuli.utils import pad


@pytest.mark.parametrize(
"img_shape, padding, result",
[
((128, 128), (64, 64), (256, 256)),
((100, 100), (64, 64), (228, 228)),
((128, 128), ((64, 64), (64, 64)), (256, 256)),
((128, 128), ((64, 64), (128, 128)), (256, 384)),
((128, 100), ((64, 64), (100, 128)), (256, 328)),
((128, 100), 64, (256, 228)),
],
)
def test_pad_by_shape(img_shape, padding, result):
img = np.ones(img_shape)
padded = pad.pad_by_shape(img, padding)
assert padded.shape == result

0 comments on commit a348153

Please sign in to comment.