# Path: pyani/aniblastall.py
# class PyaniblastallException(PyaniException):
# def get_version(blast_exe: Path = pyani_config.BLASTALL_DEFAULT) -> str:


from pathlib import Path
from pyani import aniblastall
import unittest
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"""Test aniblastall.py module.

These tests are intended to be run from the repository root using:

pytest -v
"""


# Create object for accessing unittest assertions
assertions = unittest.TestCase("__init__")


# Test get_version()
# Test case 0: no executable location is specified
def test_get_version_nonetype():
    """Test behaviour when no location for the executable is given."""
    test_file_0 = None

    assert (
        aniblastall.get_version(test_file_0) == f"{test_file_0} is not found in $PATH"
    )


# Test case 1: there is no executable
def test_get_version_missing_exe(executable_missing):
    """Test behaviour when there is no file at the specified executable location."""
    test_file_1 = Path("/non/existent/blastall")

# Path: pyani/aniblastall.py
# class PyaniblastallException(PyaniException):
# def get_version(blast_exe: Path = pyani_config.BLASTALL_DEFAULT) -> str:


# Path: tests/test_aniblastall.py
from pathlib import Path
from pyani import aniblastall
import unittest

# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"""Test aniblastall.py module.

These tests are intended to be run from the repository root using:

pytest -v
"""


# Create object for accessing unittest assertions
assertions = unittest.TestCase("__init__")


# Test get_version()
# Test case 0: no executable location is specified
def test_get_version_nonetype():
    """Test behaviour when no location for the executable is given."""
    test_file_0 = None

    assert (
        aniblastall.get_version(test_file_0) == f"{test_file_0} is not found in $PATH"
    )


# Test case 1: there is no executable
def test_get_version_missing_exe(executable_missing):
    """Test behaviour when there is no file at the specified executable location."""
    test_file_1 = Path("/non/existent/blastall")

    assert aniblastall.get_version(test_file_1) == f"No blastall at {test_file_1}"