# Path: tbmodels/exceptions.py
# class TbmodelsException(click.ClickException):
#     """
#     Custom exception class for TBmodels errors. This class should be
#     used only for exception with a well-known cause, not for unexpected
#     "crashes". For example, it can be used for malformed or incompatible
#     inputs, truncated or missing input files, and similar errors.
# 
#     Errors which use this exception class will be formatted in the CLI as::
# 
#         Error: [<exception marker name>] <error message>
#     """
# 
#     exit_code = 3
# 
#     def __init__(self, message: str, exception_marker: ExceptionMarker):
#         super().__init__(message)
#         self.exception_marker = exception_marker
# 
#     def format_message(self):
#         return f"[{self.exception_marker.name}] {super().format_message()}"


import pytest
import numpy as np
import tbmodels
from parameters import KPT
from tbmodels.exceptions import TbmodelsException
    In this case, the individual blocks in the wsvec file are complete,
    but entire blocks are missing.
    """
    with pytest.raises(KeyError):
        tbmodels.Model.from_wannier_files(
            hr_file=sample("bi_hr.dat"),
            wsvec_file=sample("bi_wsvec_blocks_missing.dat"),
            xyz_file=sample("bi_centres.xyz"),
            win_file=sample("bi.win"),
        )


def test_wsvec_blocks_incomplete(sample):
    """
    Check that a wsvec file with incomplete blocks raises an error.
    """
    with pytest.raises(TbmodelsException) as excinfo:
        tbmodels.Model.from_wannier_files(
            hr_file=sample("bi_hr.dat"),
            wsvec_file=sample("bi_wsvec_blocks_incomplete.dat"),
            xyz_file=sample("bi_centres.xyz"),
            win_file=sample("bi.win"),
        )
    assert "Incomplete wsvec iterator." in str(excinfo.value)


def test_wsvec_empty(sample):
    """
    Check that an empty wsvec file raises an error.
    """

# Path: tbmodels/exceptions.py
# class TbmodelsException(click.ClickException):
#     """
#     Custom exception class for TBmodels errors. This class should be
#     used only for exception with a well-known cause, not for unexpected
#     "crashes". For example, it can be used for malformed or incompatible
#     inputs, truncated or missing input files, and similar errors.
# 
#     Errors which use this exception class will be formatted in the CLI as::
# 
#         Error: [<exception marker name>] <error message>
#     """
# 
#     exit_code = 3
# 
#     def __init__(self, message: str, exception_marker: ExceptionMarker):
#         super().__init__(message)
#         self.exception_marker = exception_marker
# 
#     def format_message(self):
#         return f"[{self.exception_marker.name}] {super().format_message()}"


# Path: tests/test_wannier.py
import pytest
import numpy as np
import tbmodels
from parameters import KPT
from tbmodels.exceptions import TbmodelsException

    In this case, the individual blocks in the wsvec file are complete,
    but entire blocks are missing.
    """
    with pytest.raises(KeyError):
        tbmodels.Model.from_wannier_files(
            hr_file=sample("bi_hr.dat"),
            wsvec_file=sample("bi_wsvec_blocks_missing.dat"),
            xyz_file=sample("bi_centres.xyz"),
            win_file=sample("bi.win"),
        )


def test_wsvec_blocks_incomplete(sample):
    """
    Check that a wsvec file with incomplete blocks raises an error.
    """
    with pytest.raises(TbmodelsException) as excinfo:
        tbmodels.Model.from_wannier_files(
            hr_file=sample("bi_hr.dat"),
            wsvec_file=sample("bi_wsvec_blocks_incomplete.dat"),
            xyz_file=sample("bi_centres.xyz"),
            win_file=sample("bi.win"),
        )
    assert "Incomplete wsvec iterator." in str(excinfo.value)


def test_wsvec_empty(sample):
    """
    Check that an empty wsvec file raises an error.
    """

    with pytest.raises(TbmodelsException) as excinfo: