# Path: test/_common.py
# def print_test_result(expected, actual, error=None):
#     print(f"[expected]\n{expected}\n")
#     print(f"[actual]\n{actual}\n")
# 
#     if error:
#         print(error, file=sys.stderr)
# 
#     print("----------------------------------------")
# 
# Path: test/data.py
# TIME = datetime.datetime(2017, 1, 1, 0, 0, 0)
# INF = float("inf")
# NAN = float("nan")


import collections
import datetime
import pytest
import typepy
import pytablewriter
from textwrap import dedent
from ...._common import print_test_result
from ....data import (
    headers,
    mix_header_list,
    mix_value_matrix,
    value_matrix,
    value_matrix_iter,
    value_matrix_with_none,
)
            writer.write_table()


class Test_JavaScriptTableWriter_write_table_iter:
    @pytest.mark.parametrize(
        ["table", "header", "value", "iter_len", "expected"],
        [
            [
                "tablename",
                ["ha", "hb", "hc"],
                value_matrix_iter,
                len(value_matrix_iter),
                dedent(
                    """\
                    const tablename = [
                        ["ha", "hb", "hc"],
                        [1, 2, 3],
                        [11, 12, 13],
                        [1, 2, 3],
                        [11, 12, 13],
                        [101, 102, 103],
                        [1001, 1002, 1003]
                    ];
                    """
                ),
            ],
            [
                "tablename",
                ["ha", "hb", "hc"],
                value_matrix_iter,

# Path: test/_common.py
# def print_test_result(expected, actual, error=None):
#     print(f"[expected]\n{expected}\n")
#     print(f"[actual]\n{actual}\n")
# 
#     if error:
#         print(error, file=sys.stderr)
# 
#     print("----------------------------------------")
# 
# Path: test/data.py
# TIME = datetime.datetime(2017, 1, 1, 0, 0, 0)
# INF = float("inf")
# NAN = float("nan")


# Path: test/writer/text/sourcecode/test_javascript_writer.py
import collections
import datetime
import pytest
import typepy
import pytablewriter
from textwrap import dedent
from ...._common import print_test_result
from ....data import (
    headers,
    mix_header_list,
    mix_value_matrix,
    value_matrix,
    value_matrix_iter,
    value_matrix_with_none,
)

            writer.write_table()


class Test_JavaScriptTableWriter_write_table_iter:
    @pytest.mark.parametrize(
        ["table", "header", "value", "iter_len", "expected"],
        [
            [
                "tablename",
                ["ha", "hb", "hc"],
                value_matrix_iter,
                len(value_matrix_iter),
                dedent(
                    """\
                    const tablename = [
                        ["ha", "hb", "hc"],
                        [1, 2, 3],
                        [11, 12, 13],
                        [1, 2, 3],
                        [11, 12, 13],
                        [101, 102, 103],
                        [1001, 1002, 1003]
                    ];
                    """
                ),
            ],
            [
                "tablename",
                ["ha", "hb", "hc"],
                value_matrix_iter,

                len(value_matrix_iter) - 1,