Skip to content

Commit

Permalink
[Fix] Fix warning capture
Browse files Browse the repository at this point in the history
  • Loading branch information
fanqiNO1 committed Feb 18, 2024
1 parent f79111e commit 1080312
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_utils/test_dl_utils/test_torch_ops.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import warnings

import torch

from mmengine.utils.dl_utils import torch_meshgrid


def test_torch_meshgrid():
# torch_meshgrid should not throw warning
with pytest.warns(None) as record:
with warnings.catch_warnings():
warnings.simplefilter('error')
x = torch.tensor([1, 2, 3])
y = torch.tensor([4, 5, 6])
grid_x, grid_y = torch_meshgrid(x, y)

assert len(record) == 0

0 comments on commit 1080312

Please sign in to comment.