def write_table(self): """ |write_table| with HTML table format. :Example: :ref:`example-html-table-writer` .. note:: - |None| is not written """ self._logger.logging_start_write() self._verify_property() self._preprocess() if typepy.is_not_null_string(self.table_name): self._table_tag = tags.table( id=pathvalidate.sanitize_python_var_name(self.table_name)) self._table_tag += tags.caption( MultiByteStrDecoder(self.table_name).unicode_str) else: self._table_tag = tags.table() try: self._write_header() except EmptyHeaderError: pass self._write_body() self._logger.logging_complete_write()
def variable_name(self): """ :return: |table_name| that converted to a variable name. :rtype: str """ import pathvalidate return pathvalidate.sanitize_python_var_name(self.table_name, u"_")
def write_table(self): """ |write_table| with HTML table format. """ self._verify_property() self._preprocess() if dataproperty.is_not_empty_string(self.table_name): self._table_tag = tags.table( id=pathvalidate.sanitize_python_var_name(self.table_name)) self._table_tag += tags.caption(self.table_name) else: self._table_tag = tags.table() self._write_header() self._write_body()
def get_variable_name(self, value): import pathvalidate return pathvalidate.sanitize_python_var_name(self.table_name, "_").lower()
def strclear_v2(s=''): return pathvalidate.sanitize_python_var_name(s)
def test_exception_type(self, value, expected): with pytest.raises(expected): sanitize_python_var_name(value)
def test_normal_reserved(self, value, expected): assert sanitize_python_var_name(value) == expected
def test_normal_invalid_first_char_x2(self, value, replace_text, expected): sanitized_name = sanitize_python_var_name(value, replace_text) assert sanitized_name == expected validate_python_var_name(sanitized_name)