# Path: nacc/uds3/packet.py
# class Packet(list):
#     def __init__(self):
#     def __getitem__(self, key):
# 
# Path: nacc/uds3/ivp/builder.py
# def build_uds3_ivp_form(record, err=sys.stderr):
# def add_z1_or_z1x(record, packet):
# def add_a1(record, packet):
# def add_a2(record, packet):
# def add_a3(record, packet):
# def add_a4(record, packet):
# def add_a5(record, packet):
# def add_b1(record, packet):
# def add_b4(record, packet):
# def add_b5(record, packet):
# def add_b6(record, packet):
# def add_b7(record, packet):
# def add_b8(record, packet):
# def add_b9(record, packet):
# def add_c1s_or_c2(record, packet):
# def add_d1(record, packet):
# def add_d2(record, packet):
# def update_header(record, packet):
# 
# Path: nacc/uds3/fvp/builder.py
# def build_uds3_fvp_form(record, err=sys.stderr):
# def add_z1_or_z1x(record, packet):
# def add_a1(record, packet):
# def add_a2(record, packet):
# def add_a3(record, packet):
# def add_a4(record, packet):
# def add_b1(record, packet):
# def add_b4(record, packet):
# def add_b5(record, packet):
# def add_b6(record, packet):
# def add_b7(record, packet):
# def add_b8(record, packet):
# def add_b9(record, packet):
# def add_c1s_or_c2(record, packet):
# def add_d1(record, packet):
# def add_d2(record, packet):
# def update_header(record, packet):


import unittest
from nacc.uds3 import packet
from nacc.uds3.ivp import builder as ivp_builder
from nacc.uds3.fvp import builder as fvp_builder



class TestC1SC2(unittest.TestCase):

    def test_z1_added_to_ivp_when_filled(self):
        """
        If header is from before April 2, 2018, the Z1 form should be added
        """
        record = make_blank_ivp()
        record['visityr'] = '2016'
        record['a2_sub'] = '1'
        record['b7_comm'] = '1'

        ipacket = packet.Packet()
        ivp_builder.add_z1_or_z1x(record, ipacket)
        self.assertEqual(ipacket['A2SUB'], '1')

    def test_z1x_added_to_ivp_when_filled(self):
        """
        If header is from after April 2, 2018, the Z1X form should be added
        """
        record = make_blank_ivp()
        record['visityr'] = '2019'
        record['langa1'] = '1'
        record['clssub'] = '1'

        ipacket = packet.Packet()

# Path: nacc/uds3/packet.py
# class Packet(list):
#     def __init__(self):
#     def __getitem__(self, key):
# 
# Path: nacc/uds3/ivp/builder.py
# def build_uds3_ivp_form(record, err=sys.stderr):
# def add_z1_or_z1x(record, packet):
# def add_a1(record, packet):
# def add_a2(record, packet):
# def add_a3(record, packet):
# def add_a4(record, packet):
# def add_a5(record, packet):
# def add_b1(record, packet):
# def add_b4(record, packet):
# def add_b5(record, packet):
# def add_b6(record, packet):
# def add_b7(record, packet):
# def add_b8(record, packet):
# def add_b9(record, packet):
# def add_c1s_or_c2(record, packet):
# def add_d1(record, packet):
# def add_d2(record, packet):
# def update_header(record, packet):
# 
# Path: nacc/uds3/fvp/builder.py
# def build_uds3_fvp_form(record, err=sys.stderr):
# def add_z1_or_z1x(record, packet):
# def add_a1(record, packet):
# def add_a2(record, packet):
# def add_a3(record, packet):
# def add_a4(record, packet):
# def add_b1(record, packet):
# def add_b4(record, packet):
# def add_b5(record, packet):
# def add_b6(record, packet):
# def add_b7(record, packet):
# def add_b8(record, packet):
# def add_b9(record, packet):
# def add_c1s_or_c2(record, packet):
# def add_d1(record, packet):
# def add_d2(record, packet):
# def update_header(record, packet):


# Path: tests/test_z1_z1x.py
import unittest
from nacc.uds3 import packet
from nacc.uds3.ivp import builder as ivp_builder
from nacc.uds3.fvp import builder as fvp_builder




class TestC1SC2(unittest.TestCase):

    def test_z1_added_to_ivp_when_filled(self):
        """
        If header is from before April 2, 2018, the Z1 form should be added
        """
        record = make_blank_ivp()
        record['visityr'] = '2016'
        record['a2_sub'] = '1'
        record['b7_comm'] = '1'

        ipacket = packet.Packet()
        ivp_builder.add_z1_or_z1x(record, ipacket)
        self.assertEqual(ipacket['A2SUB'], '1')

    def test_z1x_added_to_ivp_when_filled(self):
        """
        If header is from after April 2, 2018, the Z1X form should be added
        """
        record = make_blank_ivp()
        record['visityr'] = '2019'
        record['langa1'] = '1'
        record['clssub'] = '1'

        ipacket = packet.Packet()

        ivp_builder.add_z1_or_z1x(record, ipacket)