Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_exception_invalid_win_char(self, value):
with pytest.raises(InvalidCharError):
validate_sqlite_attr_name(value)
def test_exception_reserved_valid(self, value, expected):
with pytest.raises(expected):
validate_sqlite_attr_name(value)
def test_normal_ascii(self, value):
validate_sqlite_attr_name(value)
def test_normal_utf8(self, value):
validate_sqlite_attr_name(value)
def test_normal_non_alphabet_first_char(self, value):
validate_sqlite_attr_name(value)
def test_exception_type(self, value, expected):
with pytest.raises(expected):
validate_sqlite_attr_name(value)
def _validate_header(self, header):
try:
pv.validate_sqlite_attr_name(header)
except (pv.NullNameError, pv.ReservedNameError):
pass
except pv.InvalidCharError as e:
raise InvalidHeaderNameError(e)
def __sanitize_header_list(self):
new_header_list = []
for i, header in enumerate(self.header_list):
try:
pathvalidate.validate_sqlite_attr_name(header)
new_header = header
except pathvalidate.ReservedNameError as e:
rename_count = 0
while True:
new_header = "{:s}_rename{:d}".format(header, rename_count)
if all([
new_header not in self.header_list[i:],
new_header not in new_header_list,
]):
break
rename_count += 1
new_header_list.append(new_header)
self.__header_list = new_header_list