Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/open-mmlab/mmcv into defo…
Browse files Browse the repository at this point in the history
…rmroipool
  • Loading branch information
jayggh committed Dec 12, 2022
2 parents bc3f29c + 4e67e48 commit 1f88e77
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/test_utils/test_version_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from unittest.mock import patch

import pytest
from packaging.version import InvalidVersion

from mmcv import get_git_hash, parse_version_info
from mmcv.utils import digit_version
Expand All @@ -24,11 +25,15 @@ def test_digit_version():
assert digit_version('1.0.0post') < digit_version('1.0.0post1')
assert digit_version('v1') == (1, 0, 0, 0, 0, 0)
assert digit_version('v1.1.5') == (1, 1, 5, 0, 0, 0)
with pytest.raises(AssertionError):

# When the version of packaging is less than 22.0,
# it throws an AssertionError if an invalid input
# is provided.
with pytest.raises((AssertionError, InvalidVersion)):
digit_version('a')
with pytest.raises(AssertionError):
with pytest.raises((AssertionError, InvalidVersion)):
digit_version('1x')
with pytest.raises(AssertionError):
with pytest.raises((AssertionError, InvalidVersion)):
digit_version('1.x')


Expand Down

0 comments on commit 1f88e77

Please sign in to comment.