# Path: simplesqlite/_validator.py
# def validate_sqlite_attr_name(name: str) -> None:
#     """
#     :param str name: Name to validate.
#     :raises pathvalidate.ValidationError:
#         - If the ``name`` includes unprintable character(s).
#         - |raises_sqlite_keywords|
#     """
# 
#     if not name:
#         raise ValidationError(["null name"], reason=ErrorReason.NULL_NAME)
# 
#     if __RE_INVALID_CHARS.search(name):
#         raise ValidationError(["unprintable character found"], reason=ErrorReason.INVALID_CHARACTER)
# 
#     name = name.upper()
# 
#     if name in __SQLITE_INVALID_RESERVED_KEYWORDS_ATTR:
#         raise ValidationError(
#             [f"'{name}' is a reserved keyword by sqlite"],
#             reason=ErrorReason.RESERVED_NAME,
#             reusable_name=False,
#         )
# 
#     if name in __SQLITE_VALID_RESERVED_KEYWORDS_ATTR:
#         raise ValidationError(
#             [f"'{name}' is a reserved keyword by sqlite"],
#             reason=ErrorReason.RESERVED_NAME,
#             reusable_name=True,
#         )
# 
# def validate_sqlite_table_name(name: str) -> None:
#     """
#     :param str name: Name to validate.
#     :raises pathvalidate.ValidationError:
#         - If the ``name`` includes unprintable character(s).
#         - |raises_sqlite_keywords|
#     """
# 
#     if not name:
#         raise ValidationError(["null name"], reason=ErrorReason.NULL_NAME)
# 
#     if __RE_INVALID_CHARS.search(name):
#         raise ValidationError(["unprintable character found"], reason=ErrorReason.INVALID_CHARACTER)
# 
#     name = name.upper()
# 
#     if name in __SQLITE_INVALID_RESERVED_KEYWORDS_TABLE:
#         raise ValidationError(
#             [f"'{name}' is a reserved keyword by sqlite"],
#             reason=ErrorReason.RESERVED_NAME,
#             reusable_name=False,
#         )
# 
#     if name in __SQLITE_VALID_RESERVED_KEYWORDS_TABLE:
#         raise ValidationError(
#             [f"'{name}' is a reserved keyword by sqlite"],
#             reason=ErrorReason.RESERVED_NAME,
#             reusable_name=True,
#         )


import string
import pytest
from pathvalidate import unprintable_ascii_chars
from pathvalidate.error import ErrorReason, ValidationError
from simplesqlite._validator import validate_sqlite_attr_name, validate_sqlite_table_name
    keyword.lower() for keyword in INVALID_RESERVED_KEYWORDS_ATTR_UPPER
]

UTF8_WORDS = [["あいうえお"], ["属性"]]


class Test_validate_sqlite_table_name:
    @pytest.mark.parametrize(
        ["value"],
        [
            [f"{keyword}a"]
            for keyword in (
                VALID_RESERVED_KEYWORDS_TABLE_UPPER
                + INVALID_RESERVED_KEYWORDS_TABLE_UPPER
                + VALID_RESERVED_KEYWORDS_ATTR_UPPER
                + INVALID_RESERVED_KEYWORDS_ATTR_UPPER
            )
        ],
    )
    def test_normal_ascii(self, value):
        validate_sqlite_table_name(value)

    @pytest.mark.parametrize(["value"], UTF8_WORDS)
    def test_normal_utf8(self, value):
        validate_sqlite_table_name(value)

    @pytest.mark.parametrize(
        ["value"], [[first_char + "hoge123"] for first_char in string.digits + "%#!-*"]
    )
    def test_normal_non_alphabet_first_char(self, value):

# Path: simplesqlite/_validator.py
# def validate_sqlite_attr_name(name: str) -> None:
#     """
#     :param str name: Name to validate.
#     :raises pathvalidate.ValidationError:
#         - If the ``name`` includes unprintable character(s).
#         - |raises_sqlite_keywords|
#     """
# 
#     if not name:
#         raise ValidationError(["null name"], reason=ErrorReason.NULL_NAME)
# 
#     if __RE_INVALID_CHARS.search(name):
#         raise ValidationError(["unprintable character found"], reason=ErrorReason.INVALID_CHARACTER)
# 
#     name = name.upper()
# 
#     if name in __SQLITE_INVALID_RESERVED_KEYWORDS_ATTR:
#         raise ValidationError(
#             [f"'{name}' is a reserved keyword by sqlite"],
#             reason=ErrorReason.RESERVED_NAME,
#             reusable_name=False,
#         )
# 
#     if name in __SQLITE_VALID_RESERVED_KEYWORDS_ATTR:
#         raise ValidationError(
#             [f"'{name}' is a reserved keyword by sqlite"],
#             reason=ErrorReason.RESERVED_NAME,
#             reusable_name=True,
#         )
# 
# def validate_sqlite_table_name(name: str) -> None:
#     """
#     :param str name: Name to validate.
#     :raises pathvalidate.ValidationError:
#         - If the ``name`` includes unprintable character(s).
#         - |raises_sqlite_keywords|
#     """
# 
#     if not name:
#         raise ValidationError(["null name"], reason=ErrorReason.NULL_NAME)
# 
#     if __RE_INVALID_CHARS.search(name):
#         raise ValidationError(["unprintable character found"], reason=ErrorReason.INVALID_CHARACTER)
# 
#     name = name.upper()
# 
#     if name in __SQLITE_INVALID_RESERVED_KEYWORDS_TABLE:
#         raise ValidationError(
#             [f"'{name}' is a reserved keyword by sqlite"],
#             reason=ErrorReason.RESERVED_NAME,
#             reusable_name=False,
#         )
# 
#     if name in __SQLITE_VALID_RESERVED_KEYWORDS_TABLE:
#         raise ValidationError(
#             [f"'{name}' is a reserved keyword by sqlite"],
#             reason=ErrorReason.RESERVED_NAME,
#             reusable_name=True,
#         )


# Path: test/test_validator.py
import string
import pytest
from pathvalidate import unprintable_ascii_chars
from pathvalidate.error import ErrorReason, ValidationError
from simplesqlite._validator import validate_sqlite_attr_name, validate_sqlite_table_name

    keyword.lower() for keyword in INVALID_RESERVED_KEYWORDS_ATTR_UPPER
]

UTF8_WORDS = [["あいうえお"], ["属性"]]


class Test_validate_sqlite_table_name:
    @pytest.mark.parametrize(
        ["value"],
        [
            [f"{keyword}a"]
            for keyword in (
                VALID_RESERVED_KEYWORDS_TABLE_UPPER
                + INVALID_RESERVED_KEYWORDS_TABLE_UPPER
                + VALID_RESERVED_KEYWORDS_ATTR_UPPER
                + INVALID_RESERVED_KEYWORDS_ATTR_UPPER
            )
        ],
    )
    def test_normal_ascii(self, value):
        validate_sqlite_table_name(value)

    @pytest.mark.parametrize(["value"], UTF8_WORDS)
    def test_normal_utf8(self, value):
        validate_sqlite_table_name(value)

    @pytest.mark.parametrize(
        ["value"], [[first_char + "hoge123"] for first_char in string.digits + "%#!-*"]
    )
    def test_normal_non_alphabet_first_char(self, value):

        validate_sqlite_table_name(value)