Skip to content

Commit 9837010

Browse files
author
NITHIVARSHA T P
committed
test: add tests for version info in zarr
As part of my open source journey, I contributed to the Zarr-Python project—a community-driven library for chunked, compressed N-dimensional arrays—by adding and validating tests for its version information. Following the project’s contribution guidelines, I set up a development environment, explored the codebase, and ensured my changes were clear and reviewable. My tests guarantee that the version metadata (zarr.__version__) is always present and correctly formatted, which is essential for bug reporting, compatibility checks, and reliable package releases. This aligns with Zarr’s commitment to high test coverage and robust, user-friendly development practices.
1 parent dd5a321 commit 9837010

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

tests/test_version.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""Tests for zarr._version module"""
2+
import pytest
3+
import importlib
4+
import sys
5+
6+
7+
def test_version_is_available():
8+
"""Test that __version__ is available and is a string."""
9+
from zarr import __version__
10+
assert __version__ is not None
11+
assert isinstance(__version__, str)
12+
assert len(__version__) > 0
13+
14+
15+
def test_version_format():
16+
"""Test that version follows basic format."""
17+
from zarr import __version__
18+
assert isinstance(__version__, str)
19+
# Basic check: should contain a dot or dash
20+
assert '.' in __version__ or '-' in __version__
21+
22+
23+
def test_version_is_not_unknown_in_normal_case():
24+
from zarr import __version__
25+
assert __version__ != "unknown"
26+

0 commit comments

Comments
 (0)