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()