# Path: foil/parsers.py
# INT_TO_BOOL = {1: True, 0: False}
# TYPE_CASTERS = {
#     str: passthrough,
#     int: parse_int,
#     float: parse_float,
#     bool: parse_bool,
#     date: parse_iso_date,
# }
# def passthrough(value):
# def parse_numeric(cast_function, value):
# def parse_bool(value):
# def parse_int_bool(value):
# def unquote(value):
# def parse_quoted_numeric(cast_function, value):
# def parse_iso_date(value):
# def parse_quoted_string(value):
# def parse_quoted_bool(value):
# def make_converters(data_types) -> dict:
# def parse_broken_json(json_text: str) -> dict:


import unittest
from datetime import date
from foil.parsers import (make_converters, parse_bool, passthrough,
                          parse_float, parse_int, parse_int_bool,
                          parse_iso_date, parse_numeric, parse_quoted_bool,
                          parse_quoted_float, parse_quoted_int,
                          parse_quoted_string, parse_quoted_numeric,
                          parse_broken_json)
        result = parse_quoted_int('"3"')

        self.assertEqual(expected, result)

    def test_numeric_nan(self):
        nulls = ['""', '']

        for val in nulls:
            with self.subTest(val=val):
                self.assertEqual(parse_quoted_numeric(float, val), None)

    def test_parse_quoted_string(self):
        mock_data = [('""', None), ('"Hello"', 'Hello')]

        for input_expected in mock_data:
            with self.subTest(input_expect=input_expected):
                result = parse_quoted_string(input_expected[0])
                expected = input_expected[1]

                self.assertEqual(expected, result)


class Klass:
    pass


class TestMakeConverters(unittest.TestCase):
    def test_casting_functions(self):
        datatype_names = ['ticker', 'shares', 'price', 'bought', 'custom']
        inputted_types = [str, int, float, bool, Klass]

# Path: foil/parsers.py
# INT_TO_BOOL = {1: True, 0: False}
# TYPE_CASTERS = {
#     str: passthrough,
#     int: parse_int,
#     float: parse_float,
#     bool: parse_bool,
#     date: parse_iso_date,
# }
# def passthrough(value):
# def parse_numeric(cast_function, value):
# def parse_bool(value):
# def parse_int_bool(value):
# def unquote(value):
# def parse_quoted_numeric(cast_function, value):
# def parse_iso_date(value):
# def parse_quoted_string(value):
# def parse_quoted_bool(value):
# def make_converters(data_types) -> dict:
# def parse_broken_json(json_text: str) -> dict:


# Path: tests/test_parsers.py
import unittest
from datetime import date
from foil.parsers import (make_converters, parse_bool, passthrough,
                          parse_float, parse_int, parse_int_bool,
                          parse_iso_date, parse_numeric, parse_quoted_bool,
                          parse_quoted_float, parse_quoted_int,
                          parse_quoted_string, parse_quoted_numeric,
                          parse_broken_json)

        result = parse_quoted_int('"3"')

        self.assertEqual(expected, result)

    def test_numeric_nan(self):
        nulls = ['""', '']

        for val in nulls:
            with self.subTest(val=val):
                self.assertEqual(parse_quoted_numeric(float, val), None)

    def test_parse_quoted_string(self):
        mock_data = [('""', None), ('"Hello"', 'Hello')]

        for input_expected in mock_data:
            with self.subTest(input_expect=input_expected):
                result = parse_quoted_string(input_expected[0])
                expected = input_expected[1]

                self.assertEqual(expected, result)


class Klass:
    pass


class TestMakeConverters(unittest.TestCase):
    def test_casting_functions(self):
        datatype_names = ['ticker', 'shares', 'price', 'bought', 'custom']
        inputted_types = [str, int, float, bool, Klass]

        expected_types = [passthrough, parse_int, parse_float,