"""Tests for duty_teller package __init__ (version fallback)."""

import importlib
from importlib.metadata import PackageNotFoundError
from unittest.mock import patch

import duty_teller


def test_version_fallback_when_package_not_installed():
    """When version('duty-teller') raises PackageNotFoundError, __version__ is '0.1.0'."""
    with patch("importlib.metadata.version", side_effect=PackageNotFoundError):
        importlib.reload(duty_teller)
    assert duty_teller.__version__ == "0.1.0"
    # Restore so other tests see normal version
    importlib.reload(duty_teller)
