# Path: nacc/uds3/clsform.py
# def add_cls(record, packet, forms, err=sys.stderr):
# 
# Path: nacc/uds3/packet.py
# class Packet(list):
#     def __init__(self):
#     def __getitem__(self, key):
# 
# Path: nacc/uds3/fvp/forms.py
# CURRENT_YEAR = date.today().year
# def header_fields():
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
# class FormA1(nacc.uds3.FieldBag):
# class FormA2(nacc.uds3.FieldBag):
# class FormA3(nacc.uds3.FieldBag):
# class FormA4D(nacc.uds3.FieldBag):
# class FormA4G(nacc.uds3.FieldBag):
# class FormB1(nacc.uds3.FieldBag):
# class FormB4(nacc.uds3.FieldBag):
# class FormB5(nacc.uds3.FieldBag):
# class FormB6(nacc.uds3.FieldBag):
# class FormB7(nacc.uds3.FieldBag):
# class FormB8(nacc.uds3.FieldBag):
# class FormB9(nacc.uds3.FieldBag):
# class FormC1S(nacc.uds3.FieldBag):
# class FormC2(nacc.uds3.FieldBag):
# class FormCLS(nacc.uds3.FieldBag):
# class FormD1(nacc.uds3.FieldBag):
# class FormD2(nacc.uds3.FieldBag):
# class FormZ1(nacc.uds3.FieldBag):
# class FormZ1X(nacc.uds3.FieldBag):
# 
# Path: nacc/uds3/ivp/forms.py
# CURRENT_YEAR = date.today().year
# class FormA4G(nacc.uds3.FieldBag):
# class FormA1(nacc.uds3.FieldBag):
# class FormA2(nacc.uds3.FieldBag):
# class FormA3(nacc.uds3.FieldBag):
# class FormA4D(nacc.uds3.FieldBag):
# class FormA5(nacc.uds3.FieldBag):
# class FormB1(nacc.uds3.FieldBag):
# class FormB4(nacc.uds3.FieldBag):
# class FormB5(nacc.uds3.FieldBag):
# class FormB6(nacc.uds3.FieldBag):
# class FormB7(nacc.uds3.FieldBag):
# class FormB8(nacc.uds3.FieldBag):
# class FormB9(nacc.uds3.FieldBag):
# class FormC1S(nacc.uds3.FieldBag):
# class FormC2(nacc.uds3.FieldBag):
# class FormCLS(nacc.uds3.FieldBag):
# class FormD1(nacc.uds3.FieldBag):
# class FormD2(nacc.uds3.FieldBag):
# class FormZ1(nacc.uds3.FieldBag):
# class FormZ1X(nacc.uds3.FieldBag):
#     def __init__(self):
# def header_fields():
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):


import unittest
from io import StringIO
from nacc.uds3 import clsform
from nacc.uds3 import packet
from nacc.uds3.fvp import forms as fvp_forms
from nacc.uds3.ivp import forms as ivp_forms
        """
        record = make_filled_record()
        record['eng_percentage_english'] = '20'
        record['eng_percentage_spanish'] = '91'

        ipacket = packet.Packet()
        itrap = StringIO()
        clsform.add_cls(record, ipacket, ivp_forms, itrap)
        assert itrap.getvalue() == "[WARNING] language proficiency percentages do not equal 100 for PTID : unknown\n"
        itrap.close()

        fpacket = packet.Packet()
        ftrap = StringIO()
        clsform.add_cls(record, fpacket, fvp_forms, ftrap)
        assert ftrap.getvalue() == "[WARNING] language proficiency percentages do not equal 100 for PTID : unknown\n"
        ftrap.close()

    def test_check_cls_date(self):
        """
        Having a CLS with a visit date before June 1, 2017 raises an exception.
        """
        record = make_filled_record()
        record['visityr'] = '2016'

        ipacket = packet.Packet()
        with self.assertRaises(Exception):
            clsform.add_cls(record, ipacket, ivp_forms)

        fpacket = packet.Packet()
        with self.assertRaises(Exception):

# Path: nacc/uds3/clsform.py
# def add_cls(record, packet, forms, err=sys.stderr):
# 
# Path: nacc/uds3/packet.py
# class Packet(list):
#     def __init__(self):
#     def __getitem__(self, key):
# 
# Path: nacc/uds3/fvp/forms.py
# CURRENT_YEAR = date.today().year
# def header_fields():
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
# class FormA1(nacc.uds3.FieldBag):
# class FormA2(nacc.uds3.FieldBag):
# class FormA3(nacc.uds3.FieldBag):
# class FormA4D(nacc.uds3.FieldBag):
# class FormA4G(nacc.uds3.FieldBag):
# class FormB1(nacc.uds3.FieldBag):
# class FormB4(nacc.uds3.FieldBag):
# class FormB5(nacc.uds3.FieldBag):
# class FormB6(nacc.uds3.FieldBag):
# class FormB7(nacc.uds3.FieldBag):
# class FormB8(nacc.uds3.FieldBag):
# class FormB9(nacc.uds3.FieldBag):
# class FormC1S(nacc.uds3.FieldBag):
# class FormC2(nacc.uds3.FieldBag):
# class FormCLS(nacc.uds3.FieldBag):
# class FormD1(nacc.uds3.FieldBag):
# class FormD2(nacc.uds3.FieldBag):
# class FormZ1(nacc.uds3.FieldBag):
# class FormZ1X(nacc.uds3.FieldBag):
# 
# Path: nacc/uds3/ivp/forms.py
# CURRENT_YEAR = date.today().year
# class FormA4G(nacc.uds3.FieldBag):
# class FormA1(nacc.uds3.FieldBag):
# class FormA2(nacc.uds3.FieldBag):
# class FormA3(nacc.uds3.FieldBag):
# class FormA4D(nacc.uds3.FieldBag):
# class FormA5(nacc.uds3.FieldBag):
# class FormB1(nacc.uds3.FieldBag):
# class FormB4(nacc.uds3.FieldBag):
# class FormB5(nacc.uds3.FieldBag):
# class FormB6(nacc.uds3.FieldBag):
# class FormB7(nacc.uds3.FieldBag):
# class FormB8(nacc.uds3.FieldBag):
# class FormB9(nacc.uds3.FieldBag):
# class FormC1S(nacc.uds3.FieldBag):
# class FormC2(nacc.uds3.FieldBag):
# class FormCLS(nacc.uds3.FieldBag):
# class FormD1(nacc.uds3.FieldBag):
# class FormD2(nacc.uds3.FieldBag):
# class FormZ1(nacc.uds3.FieldBag):
# class FormZ1X(nacc.uds3.FieldBag):
#     def __init__(self):
# def header_fields():
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):
#     def __init__(self):


# Path: tests/test_cls.py
import unittest
from io import StringIO
from nacc.uds3 import clsform
from nacc.uds3 import packet
from nacc.uds3.fvp import forms as fvp_forms
from nacc.uds3.ivp import forms as ivp_forms

        """
        record = make_filled_record()
        record['eng_percentage_english'] = '20'
        record['eng_percentage_spanish'] = '91'

        ipacket = packet.Packet()
        itrap = StringIO()
        clsform.add_cls(record, ipacket, ivp_forms, itrap)
        assert itrap.getvalue() == "[WARNING] language proficiency percentages do not equal 100 for PTID : unknown\n"
        itrap.close()

        fpacket = packet.Packet()
        ftrap = StringIO()
        clsform.add_cls(record, fpacket, fvp_forms, ftrap)
        assert ftrap.getvalue() == "[WARNING] language proficiency percentages do not equal 100 for PTID : unknown\n"
        ftrap.close()

    def test_check_cls_date(self):
        """
        Having a CLS with a visit date before June 1, 2017 raises an exception.
        """
        record = make_filled_record()
        record['visityr'] = '2016'

        ipacket = packet.Packet()
        with self.assertRaises(Exception):
            clsform.add_cls(record, ipacket, ivp_forms)

        fpacket = packet.Packet()
        with self.assertRaises(Exception):

            clsform.add_cls(record, fpacket, fvp_forms)