Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

apply autopep8 to test_utils.py

edgarriba3f3efad45cb2
diff --git a/test/test_utils.py b/test/test_utils.py
index c02b4ff56..b6f840222 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -6,22 +6,25 @@ import torchgeometry as tgm
import utils # test utils
+
@pytest.mark.parametrize("batch_shape",
- [(4, 4), (1, 4, 4), (3, 4, 4),])
+ [(4, 4), (1, 4, 4), (3, 4, 4), ])
def test_tensor_to_image(batch_shape):
tensor = torch.ones(batch_shape)
image = tgm.tensor_to_image(tensor)
assert image.shape[:2] == batch_shape[-2:]
assert isinstance(image, np.ndarray)
+
@pytest.mark.parametrize("batch_shape",
- [(4, 4), (4, 4, 1), (4, 4, 3),])
+ [(4, 4), (4, 4, 1), (4, 4, 3), ])
def test_image_to_tensor(batch_shape):
image = np.ones(batch_shape)
tensor = tgm.image_to_tensor(image)
assert tensor.shape[-2:] == batch_shape[:2]
assert isinstance(tensor, torch.Tensor)
+
def test_create_meshgrid():
height, width = 4, 6
normalized_coordinates = False
@@ -32,9 +35,10 @@ def test_create_meshgrid():
# check grid corner values
assert tuple(grid[0, 0, 0].numpy()) == (0., 0.)
- assert tuple( \
+ assert tuple(
grid[0, height - 1, width - 1].numpy()) == (width - 1, height - 1)
+
def test_normalize_pixel_grid():
# generate input data
batch_size = 1