예제 #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()
예제 #2
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"_")
예제 #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"_")
예제 #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()
예제 #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()
예제 #6
0
    def get_variable_name(self, value):
        import pathvalidate

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