Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
MMCV
Commits
4e67e481
Unverified
Commit
4e67e481
authored
Dec 11, 2022
by
Zaida Zhou
Committed by
GitHub
Dec 11, 2022
Browse files
[Fix] Fix ut caused by the new version of packaging (#2482)
parent
37aa6dd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
tests/test_utils/test_version_utils.py
tests/test_utils/test_version_utils.py
+8
-3
No files found.
tests/test_utils/test_version_utils.py
View file @
4e67e481
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
from
unittest.mock
import
patch
from
unittest.mock
import
patch
import
pytest
import
pytest
from
packaging.version
import
InvalidVersion
from
mmcv
import
get_git_hash
,
parse_version_info
from
mmcv
import
get_git_hash
,
parse_version_info
from
mmcv.utils
import
digit_version
from
mmcv.utils
import
digit_version
...
@@ -24,11 +25,15 @@ def test_digit_version():
...
@@ -24,11 +25,15 @@ def test_digit_version():
assert
digit_version
(
'1.0.0post'
)
<
digit_version
(
'1.0.0post1'
)
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
,
0
,
0
,
0
,
0
,
0
)
assert
digit_version
(
'v1.1.5'
)
==
(
1
,
1
,
5
,
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'
)
digit_version
(
'a'
)
with
pytest
.
raises
(
AssertionError
):
with
pytest
.
raises
(
(
AssertionError
,
InvalidVersion
)
):
digit_version
(
'1x'
)
digit_version
(
'1x'
)
with
pytest
.
raises
(
AssertionError
):
with
pytest
.
raises
(
(
AssertionError
,
InvalidVersion
)
):
digit_version
(
'1.x'
)
digit_version
(
'1.x'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment