Skip to content

Commit

Permalink
add __version__
Browse files Browse the repository at this point in the history
  • Loading branch information
oconnor663 committed Feb 16, 2021
1 parent 6fe91b9 commit 38aca74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,5 +318,6 @@ fn blake3(_: Python, m: &PyModule) -> PyResult<()> {
m.add_wrapped(wrap_pyfunction!(blake3))?;
m.add("OUT_LEN", blake3::OUT_LEN)?;
m.add("KEY_LEN", blake3::KEY_LEN)?;
m.add("__version__", env!("CARGO_PKG_VERSION"))?;
Ok(())
}
9 changes: 8 additions & 1 deletion tests/test_blake3.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys

try:
from blake3 import blake3
from blake3 import blake3, __version__
except ModuleNotFoundError:
print("Run tests/build.py first.", file=sys.stderr)
raise
Expand Down Expand Up @@ -243,3 +243,10 @@ def test_copy_multithreading():

h2.update(b3, multithreading=True)
assert h2.digest() == h3.digest(), "Update state of copy diverged from expected state"


def test_version():
# Just sanity check that it's a version string. No need to try to go out of
# our way to parse Cargo.toml.
assert type(__version__) is str
assert len(__version__.split(".")) == 3

0 comments on commit 38aca74

Please sign in to comment.