How to use the pytablewriter.TableWriterFactory function in pytablewriter

To help you get started, we’ve selected a few pytablewriter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thombashi / pytablewriter / test / test_writer_factory.py View on Github external
def test_normal(self):
        assert ptw.TableWriterFactory.get_extensions() == [
            "csv",
            "htm",
            "html",
            "js",
            "json",
            "jsonl",
            "ldjson",
            "ltsv",
            "md",
            "ndjson",
            "py",
            "rst",
            "sqlite",
            "sqlite3",
            "tex",
            "toml",
github thombashi / pytablewriter / test / test_writer_factory.py View on Github external
def test_normal(self, value, expected):
        writer = ptw.TableWriterFactory.create_from_file_extension(value)

        assert isinstance(writer, expected)
github thombashi / pytablewriter / test / test_writer_factory.py View on Github external
def test_normal(self):
        assert ptw.TableWriterFactory.get_format_names() == [
            "csv",
            "elasticsearch",
            "excel",
            "htm",
            "html",
            "javascript",
            "js",
            "json",
            "json_lines",
            "jsonl",
            "latex_matrix",
            "latex_table",
            "ldjson",
            "ltsv",
            "markdown",
            "md",
github thombashi / pytablewriter / test / writer / text / test_multibyte.py View on Github external
            for format_name in ptw.TableWriterFactory.get_format_names()
            if format_name not in ["null", "elasticsearch", "excel", "sqlite"]
        ],
    )
    def test_smoke_multi_byte(self, capsys, format_name):
        writer = ptw.TableWriterFactory.create_from_format_name(format_name)
        writer.table_name = "生成に関するパターン"
        writer.headers = ["パターン名", "概要", "GoF", "Code Complete[1]"]
        writer.value_matrix = [
            ["Abstract Factory", "関連する一連のインスタンスを状況に応じて、適切に生成する方法を提供する。", "Yes", "Yes"],
            ["Builder", "複合化されたインスタンスの生成過程を隠蔽する。", "Yes", "No"],
            ["Factory Method", "実際に生成されるインスタンスに依存しない、インスタンスの生成方法を提供する。", "Yes", "Yes"],
            ["Prototype", "同様のインスタンスを生成するために、原型のインスタンスを複製する。", "Yes", "No"],
            ["Singleton", "あるクラスについて、インスタンスが単一であることを保証する。", "Yes", "Yes"],
        ]

        writer.write_table()