# 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 itertools
import json
import pytest
import pytablewriter as ptw
from decimal import Decimal
from textwrap import dedent
from ..._common import print_test_result
from ...data import float_header_list, float_value_matrix, headers, value_matrix
    @pytest.mark.parametrize(
        ["header", "value", "expected_list"],
        [[data.header, data.value, data.expected_list] for data in exception_test_data_list],
    )
    def test_exception(self, header, value, expected_list):
        writer = table_writer_class()
        writer.headers = header
        writer.value_matrix = value

        with pytest.raises(expected_list):
            writer.write_table()

    def test_normal_mix_types(self):
        expected_list = dedent(
            """\
            {"a": "abc", "b": true, "f": "NaN", "i": 0, "n": 0.1}
            {"a": "abcdef", "b": false, "f": "Infinity", "i": -1, "n": null}
            {"a": "", "b": false, "f": "Infinity", "i": 1, "n": null}
            """
        ).splitlines()

        writer = table_writer_class()
        writer.headers = ["a", "i", "f", "b", "n"]
        writer.value_matrix = [
            ["abc", 0, float("nan"), True, 0.1],
            ["abcdef", -1, float("inf"), False, None],
            ["", 1, Decimal("inf"), False, None],
        ]

        for actual, expected in zip(writer.dumps(sort_keys=True).splitlines(), expected_list):

# 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/test_jsonlines_writer.py
import collections
import itertools
import json
import pytest
import pytablewriter as ptw
from decimal import Decimal
from textwrap import dedent
from ..._common import print_test_result
from ...data import float_header_list, float_value_matrix, headers, value_matrix

    @pytest.mark.parametrize(
        ["header", "value", "expected_list"],
        [[data.header, data.value, data.expected_list] for data in exception_test_data_list],
    )
    def test_exception(self, header, value, expected_list):
        writer = table_writer_class()
        writer.headers = header
        writer.value_matrix = value

        with pytest.raises(expected_list):
            writer.write_table()

    def test_normal_mix_types(self):
        expected_list = dedent(
            """\
            {"a": "abc", "b": true, "f": "NaN", "i": 0, "n": 0.1}
            {"a": "abcdef", "b": false, "f": "Infinity", "i": -1, "n": null}
            {"a": "", "b": false, "f": "Infinity", "i": 1, "n": null}
            """
        ).splitlines()

        writer = table_writer_class()
        writer.headers = ["a", "i", "f", "b", "n"]
        writer.value_matrix = [
            ["abc", 0, float("nan"), True, 0.1],
            ["abcdef", -1, float("inf"), False, None],
            ["", 1, Decimal("inf"), False, None],
        ]

        for actual, expected in zip(writer.dumps(sort_keys=True).splitlines(), expected_list):

            print_test_result(expected=expected, actual=actual)