# Path: string_utils/errors.py
# class InvalidInputError(TypeError):
#     """
#     Custom error raised when received object is not a string as expected.
#     """
# 
#     def __init__(self, input_data: Any):
#         """
#         :param input_data: Any received object
#         """
#         type_name = type(input_data).__name__
#         msg = 'Expected "str", received "{}"'.format(type_name)
#         super().__init__(msg)
# 
# Path: string_utils/validation.py
# def is_isbn(input_string: str, normalize: bool = True) -> bool:
#     """
#     Checks if the given string represents a valid ISBN (International Standard Book Number).
#     By default hyphens in the string are ignored, so digits can be separated in different ways, by calling this
#     function with `normalize=False` only digit-only strings will pass the validation.
# 
#     *Examples:*
# 
#     >>> is_isbn('9780312498580') # returns true
#     >>> is_isbn('1506715214') # returns true
# 
#     :param input_string: String to check.
#     :param normalize: True to ignore hyphens ("-") in the string (default), false otherwise.
#     :return: True if valid ISBN (10 or 13), false otherwise.
#     """
#     checker = __ISBNChecker(input_string, normalize)
#     return checker.is_isbn_13() or checker.is_isbn_10()


from unittest import TestCase
from string_utils.errors import InvalidInputError
from string_utils.validation import is_isbn



class IsISBNTestCase(TestCase):
    def test_requires_valid_string(self):
        # noinspection PyTypeChecker
        self.assertRaises(InvalidInputError, lambda: is_isbn(None))

        # noinspection PyTypeChecker

# Path: string_utils/errors.py
# class InvalidInputError(TypeError):
#     """
#     Custom error raised when received object is not a string as expected.
#     """
# 
#     def __init__(self, input_data: Any):
#         """
#         :param input_data: Any received object
#         """
#         type_name = type(input_data).__name__
#         msg = 'Expected "str", received "{}"'.format(type_name)
#         super().__init__(msg)
# 
# Path: string_utils/validation.py
# def is_isbn(input_string: str, normalize: bool = True) -> bool:
#     """
#     Checks if the given string represents a valid ISBN (International Standard Book Number).
#     By default hyphens in the string are ignored, so digits can be separated in different ways, by calling this
#     function with `normalize=False` only digit-only strings will pass the validation.
# 
#     *Examples:*
# 
#     >>> is_isbn('9780312498580') # returns true
#     >>> is_isbn('1506715214') # returns true
# 
#     :param input_string: String to check.
#     :param normalize: True to ignore hyphens ("-") in the string (default), false otherwise.
#     :return: True if valid ISBN (10 or 13), false otherwise.
#     """
#     checker = __ISBNChecker(input_string, normalize)
#     return checker.is_isbn_13() or checker.is_isbn_10()


# Path: tests/test_is_isbn.py
from unittest import TestCase
from string_utils.errors import InvalidInputError
from string_utils.validation import is_isbn




class IsISBNTestCase(TestCase):
    def test_requires_valid_string(self):
        # noinspection PyTypeChecker
        self.assertRaises(InvalidInputError, lambda: is_isbn(None))

        # noinspection PyTypeChecker

        self.assertRaises(InvalidInputError, lambda: is_isbn(True))