Skip to content

Commit 1a29ce5

Browse files
authored
Merge pull request #66 from casework/update_version_retrieval_test
Update version retrieval test
2 parents 4de0cea + 7f7a76e commit 1a29ce5

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

tests/test_version.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22

3-
# Portions of this file contributed by NIST are governed by the following
4-
# statement:
3+
# Portions of this file contributed by NIST are governed by the
4+
# following statement:
55
#
66
# This software was developed at the National Institute of Standards
77
# and Technology by employees of the Federal Government in the course
@@ -14,12 +14,22 @@
1414
#
1515
# We would appreciate acknowledgement if the software is used.
1616

17+
import importlib
18+
1719
import case_mapping
1820

1921

2022
def test_version() -> None:
21-
version = case_mapping.__version__
22-
assert version is not None
23-
assert isinstance(version, str)
23+
"""
24+
This test confirms the package version is retrievable and non-null.
25+
"""
26+
version_by_init = case_mapping.__version__
27+
assert version_by_init is not None
28+
assert isinstance(version_by_init, str)
2429
# Ensure the version matches the expected major.minor.build format
25-
assert len(version.split(".")) == 3
30+
assert len(version_by_init.split(".")) == 3
31+
32+
version_by_metadata = importlib.metadata.version("case_mapping")
33+
assert version_by_metadata is not None
34+
35+
assert version_by_init == version_by_metadata

0 commit comments

Comments
 (0)