Coverage for tests/test_main.py: 100%
20 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-30 23:02 +0000
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-30 23:02 +0000
1"""Tests for the package namespace."""
3from __future__ import annotations
5import importlib.resources
6import pathlib
7import re
9import bunches
12def test_all_exports() -> None:
13 """Tests that everything in `__all__` is importable."""
14 for name in bunches.__all__:
15 assert hasattr(bunches, name)
16 assert set(bunches.__all__) == {
17 'Bunch', 'Catalog', 'ChainDict', 'DictList', 'Dictionary', 'Listing',
18 'Repository'}
21def test_metadata() -> None:
22 """Tests package metadata."""
23 assert re.fullmatch(r'\d+\.\d+\.\d+.*', bunches.__version__)
24 assert bunches.__author__ == 'Corey Rayburn Yung'
27def test_python_requirement() -> None:
28 """Tests that pyproject.toml requires Python 3.11 or later."""
29 path = pathlib.Path(__file__).parents[1] / 'pyproject.toml'
30 text = path.read_text(encoding = 'utf-8')
31 assert 'requires-python = ">=3.11"' in text
32 assert 'Python :: 3.10' not in text
35def test_py_typed() -> None:
36 """Tests that the package includes the `py.typed` marker."""
37 marker = importlib.resources.files('bunches').joinpath('py.typed')
38 assert marker.is_file()