def _validate_table_name(self, table_name): try: pv.validate_sqlite_table_name(table_name) except pv.ValidReservedNameError: pass except (pv.InvalidReservedNameError, pv.InvalidCharError) as e: raise InvalidTableNameError(e)
def validate_table_name(name): """ :param str name: Table name to validate. :raises InvalidTableNameError: |raises_validate_table_name| """ try: pathvalidate.validate_sqlite_table_name(name) except pathvalidate.InvalidReservedNameError as e: raise InvalidTableNameError(e) except pathvalidate.NullNameError: raise InvalidTableNameError("table name is empty") except pathvalidate.InvalidCharError as e: raise InvalidTableNameError(e)
def validate_table_name(name): """ :param str name: Table name to validate. :raises InvalidTableNameError: |raises_validate_table_name| """ from ._error import InvalidTableNameError try: pathvalidate.validate_sqlite_table_name(name) except pathvalidate.InvalidReservedNameError as e: raise InvalidTableNameError(e) except pathvalidate.NullNameError: raise InvalidTableNameError("table name is empty") except pathvalidate.InvalidCharError as e: raise InvalidTableNameError(e)
def test_normal_utf8(self, value): validate_sqlite_table_name(value)
def test_normal_ascii(self, value): validate_sqlite_table_name(value)
def test_exception_reserved_invalid_name(self, value, expected): with pytest.raises(expected): validate_sqlite_table_name(value)
def test_exception_invalid_win_char(self, value): with pytest.raises(InvalidCharError): validate_sqlite_table_name(value)
def test_normal_non_alphabet_first_char(self, value): validate_sqlite_table_name(value)