Example #1
0
 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)
Example #2
0
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)
Example #3
0
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)
Example #4
0
 def test_normal_utf8(self, value):
     validate_sqlite_table_name(value)
Example #5
0
 def test_normal_ascii(self, value):
     validate_sqlite_table_name(value)
Example #6
0
 def test_exception_reserved_invalid_name(self, value, expected):
     with pytest.raises(expected):
         validate_sqlite_table_name(value)
Example #7
0
 def test_exception_invalid_win_char(self, value):
     with pytest.raises(InvalidCharError):
         validate_sqlite_table_name(value)
Example #8
0
 def test_normal_non_alphabet_first_char(self, value):
     validate_sqlite_table_name(value)