"""
Coverage tests for constants.py - untested branches.
"""

import pytest

# ========================================================================
# Constants existence checks
# ========================================================================


def test_constants_opcode():
    """Test OpCode constants."""
    try:
        from bsv.constants import OpCode

        assert hasattr(OpCode, "OP_0") or hasattr(OpCode, "OP_FALSE")
        assert hasattr(OpCode, "OP_1")
    except ImportError:
        pytest.skip("Constants not available")


def test_constants_sighash():
    """Test SIGHASH constants."""
    try:
        from bsv.constants import SIGHASH

        assert hasattr(SIGHASH, "ALL") or hasattr(SIGHASH, "FORKID")
    except ImportError:
        pytest.skip("SIGHASH not available")


def test_constants_network():
    """Test Network constants."""
    try:
        from bsv.constants import Network

        assert hasattr(Network, "MAINNET")
    except (ImportError, AttributeError):
        pytest.skip("Network constants not available")


# ========================================================================
# Value checks
# ========================================================================


def test_op_values():
    """Test OpCode values are integers."""
    try:
        from bsv.constants import OpCode

        if hasattr(OpCode, "OP_0"):
            assert isinstance(OpCode.OP_0, (int, bytes))
    except ImportError:
        pytest.skip("OpCode not available")


def test_sighash_values():
    """Test SIGHASH values."""
    try:
        from bsv.constants import SIGHASH

        if hasattr(SIGHASH, "ALL"):
            assert SIGHASH.ALL is not None
    except ImportError:
        pytest.skip("SIGHASH not available")
