Example #1
0
    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"_")
Example #3
0
    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"_")
Example #4
0
    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()
Example #5
0
    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()
Example #6
0
    def get_variable_name(self, value):
        import pathvalidate

        return pathvalidate.sanitize_python_var_name(self.table_name,
                                                     "_").lower()
Example #7
0
def strclear_v2(s=''):
    return pathvalidate.sanitize_python_var_name(s)
Example #8
0
 def test_exception_type(self, value, expected):
     with pytest.raises(expected):
         sanitize_python_var_name(value)
Example #9
0
 def test_normal_reserved(self, value, expected):
     assert sanitize_python_var_name(value) == expected
Example #10
0
 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)