# 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

class TestCLS(unittest.TestCase):

    def test_cls_blank_not_added_to_ivp(self):
        """Don't add blank CLS form to IVP."""
        record = make_blank_record()
        record['hispanic'] = '1'  # Subject is Hispanic/Latino.

        ipacket = packet.Packet()
        clsform.add_cls(record, ipacket, ivp_forms)
        self.assertEqual(len(ipacket), 0, "Expected packet to be empty")

        fpacket = packet.Packet()
        clsform.add_cls(record, fpacket, fvp_forms)
        self.assertEqual(len(fpacket), 0, "Expected packet to be empty")

    def test_cls_not_added_if_not_hispanic(self):
        """
        Do not add Form CLS if the subject is not Hispanic/Latino.

        https://www.alz.washington.edu/NONMEMBER/UDS/DOCS/VER3/CLS/CLS_en.pdf
        """
        record = make_blank_record()
        record['hispanic'] = '0'  # Subject is not Hispanic/Latino.

        ipacket = packet.Packet()
        clsform.add_cls(record, ipacket, ivp_forms)
        self.assertEqual(len(ipacket), 0, "Expected packet to be empty")

        fpacket = packet.Packet()

# 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


class TestCLS(unittest.TestCase):

    def test_cls_blank_not_added_to_ivp(self):
        """Don't add blank CLS form to IVP."""
        record = make_blank_record()
        record['hispanic'] = '1'  # Subject is Hispanic/Latino.

        ipacket = packet.Packet()
        clsform.add_cls(record, ipacket, ivp_forms)
        self.assertEqual(len(ipacket), 0, "Expected packet to be empty")

        fpacket = packet.Packet()
        clsform.add_cls(record, fpacket, fvp_forms)
        self.assertEqual(len(fpacket), 0, "Expected packet to be empty")

    def test_cls_not_added_if_not_hispanic(self):
        """
        Do not add Form CLS if the subject is not Hispanic/Latino.

        https://www.alz.washington.edu/NONMEMBER/UDS/DOCS/VER3/CLS/CLS_en.pdf
        """
        record = make_blank_record()
        record['hispanic'] = '0'  # Subject is not Hispanic/Latino.

        ipacket = packet.Packet()
        clsform.add_cls(record, ipacket, ivp_forms)
        self.assertEqual(len(ipacket), 0, "Expected packet to be empty")

        fpacket = packet.Packet()

        clsform.add_cls(record, fpacket, fvp_forms)