Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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",
def test_normal(self, value, expected):
writer = ptw.TableWriterFactory.create_from_file_extension(value)
assert isinstance(writer, expected)
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",
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()