Ejemplo n.º 1
0
def test_noreform_documentation():
    """
    Test automatic documentation creation.
    """
    reform_json = """
    {
    "policy": {}
    }
    """
    assump_json = """
    {
    "consumption": {},
    "growdiff_baseline": {},
    "growdiff_response": {}
    }
    """
    params = Calculator.read_json_param_objects(reform_json, assump_json)
    assert isinstance(params, dict)
    actual_doc = Calculator.reform_documentation(params)
    expected_doc = (
        'REFORM DOCUMENTATION\n'
        'Baseline Growth-Difference Assumption Values by Year:\n'
        'none: using default baseline growth assumptions\n'
        'Policy Reform Parameter Values by Year:\n'
        'none: using current-law policy parameters\n'
    )
    assert actual_doc == expected_doc
def test_noreform_documentation():
    """
    Test automatic documentation creation.
    """
    reform_json = """
    {
    }
    """
    assump_json = """
    {
    "consumption": {},
    "growdiff_baseline": {},
    "growdiff_response": {}
    }
    """
    params = Calculator.read_json_param_objects(reform_json, assump_json)
    assert isinstance(params, dict)
    actual_doc = Calculator.reform_documentation(params)
    expected_doc = ('REFORM DOCUMENTATION\n'
                    'Baseline Growth-Difference Assumption Values by Year:\n'
                    'none: using default growth assumptions\n'
                    'Response Growth-Difference Assumption Values by Year:\n'
                    'none: using default growth assumptions\n'
                    'Policy Reform Parameter Values by Year:\n'
                    'none: using current-law policy parameters\n')
    assert actual_doc == expected_doc
Ejemplo n.º 3
0
def test_reform_documentation():
    reform_json = """
    {
    "policy": {
      "_II_em_cpi": {"2016": false,
                     "2018": true},
      "_II_em": {"2016": [5000],
                 "2018": [6000],
                 "2020": [7000]},
      "_EITC_indiv": {"2017": [true]},
      "_STD_Aged_cpi": {"2016": false},
      "_STD_Aged": {"2016": [[1600, 1300, 1300, 1600, 1600]],
                    "2020": [[2000, 2000, 2000, 2000, 2000]]},
      "_ID_BenefitCap_Switch_medical": {"2020": [false]},
      "_ID_BenefitCap_Switch_casualty": {"2020": [false]},
      "_ID_BenefitCap_Switch_misc": {"2020": [false]},
      "_ID_BenefitCap_Switch_interest": {"2020": [false]},
      "_ID_BenefitCap_Switch_charity": {"2020": [false]}
      }
    }
    """
    params = Calculator.read_json_param_objects(reform_json, None)
    assert isinstance(params, dict)
    doc = Calculator.reform_documentation(params)
    assert isinstance(doc, str)
    dump = False  # set to True to print documentation and force test failure
    if dump:
        print(doc)
        assert 1 == 2
Ejemplo n.º 4
0
def test_noreform_documentation():
    reform_json = """
    {
    "policy": {}
    }
    """
    params = Calculator.read_json_param_objects(reform_json, None)
    assert isinstance(params, dict)
    actual_doc = Calculator.reform_documentation(params)
    expected_doc = ('REFORM DOCUMENTATION\n'
                    'Policy Reform Parameter Values by Year:\n'
                    'none: using current-law policy parameters\n')
    assert actual_doc == expected_doc
def test_reform_documentation():
    """
    Test automatic documentation creation.
    """
    reform_json = """
{
"policy": {
    "II_em-indexed": {
        "2016": false,
        "2018": true
    },
    "II_em": {
        "2016": 5000,
        "2018": 6000,
        "2020": 7000
    },
    "EITC_indiv": {
        "2017": true
    },
    "STD_Aged-indexed": {
        "2016": false
    },
    "STD_Aged": {
        "2016": [1600, 1300, 1300, 1600, 1600],
        "2020": [2000, 2000, 2000, 2000, 2000]
    },
    "ID_BenefitCap_Switch": {
        "2020": [false, false, false, false, false, false, false]
    }
}
}
"""
    assump_json = """
{
"consumption": {},
// increase baseline inflation rate by one percentage point in 2014+
// (has no effect on known policy parameter values)
"growdiff_baseline": {"ACPIU": {"2014": 0.010}},
"growdiff_response": {"ACPIU": {"2014": 0.015}}
}
"""
    params = Calculator.read_json_param_objects(reform_json, assump_json)
    assert isinstance(params, dict)
    second_reform = {'II_em': {2019: 6500}}
    doc = Calculator.reform_documentation(params, [second_reform])
    assert isinstance(doc, str)
    dump = False  # set to True to print documentation and force test failure
    if dump:
        print(doc)
        assert 1 == 2
def test_reform_documentation():
    """
    Test automatic documentation creation.
    """
    reform_json = """
{
    "II_em-indexed": {
        "2016": false,
        "2018": true
    },
    "II_em": {
        "2016": 5000,
        "2018": 6000,
        "2020": 7000
    },
    "EITC_indiv": {
        "2017": true
    },
    "STD_Aged-indexed": {
        "2016": false
    },
    "STD_Aged": {
        "2016": [1600, 1300, 1300, 1600, 1600],
        "2020": [2000, 2000, 2000, 2000, 2000]
    },
    "ID_BenefitCap_Switch": {
        "2020": [false, false, false, false, false, false, false]
    }
}
"""
    assump_json = """
{
"consumption": {},
// increase baseline inflation rate by one percentage point in 2014+
// (has no effect on known policy parameter values)
"growdiff_baseline": {"ACPIU": {"2014": 0.010}},
"growdiff_response": {"ACPIU": {"2014": 0.015}}
}
"""
    params = Calculator.read_json_param_objects(reform_json, assump_json)
    assert isinstance(params, dict)
    second_reform = {'II_em': {2019: 6500}}
    doc = Calculator.reform_documentation(params, [second_reform])
    assert isinstance(doc, str)
    dump = False  # set to True to print documentation and force test failure
    if dump:
        print(doc)
        assert 1 == 2
Ejemplo n.º 7
0
def test_reform_documentation():
    """
    Test automatic documentation creation.
    """
    reform_json = """
    {
    "policy": {
      "_II_em_cpi": {"2016": false,
                     "2018": true},
      "_II_em": {"2016": [5000],
                 "2018": [6000],
                 "2020": [7000]},
      "_EITC_indiv": {"2017": [true]},
      "_STD_Aged_cpi": {"2016": false},
      "_STD_Aged": {"2016": [[1600, 1300, 1300, 1600, 1600]],
                    "2020": [[2000, 2000, 2000, 2000, 2000]]},
      "_ID_BenefitCap_Switch_medical": {"2020": [false]},
      "_ID_BenefitCap_Switch_casualty": {"2020": [false]},
      "_ID_BenefitCap_Switch_misc": {"2020": [false]},
      "_ID_BenefitCap_Switch_interest": {"2020": [false]},
      "_ID_BenefitCap_Switch_charity": {"2020": [false]}
      }
    }
    """
    assump_json = """
    {
    "consumption": {},
    // increase baseline inflation rate by one percentage point in 2014+
    // (has no effect on known policy parameter values)
    "growdiff_baseline": {"_ACPIU": {"2014": [0.01]}},
    "growdiff_response": {}
    }
    """
    params = Calculator.read_json_param_objects(reform_json, assump_json)
    assert isinstance(params, dict)
    doc = Calculator.reform_documentation(params)
    assert isinstance(doc, str)
    dump = False  # set to True to print documentation and force test failure
    if dump:
        print(doc)
        assert 1 == 2
Ejemplo n.º 8
0
def test_reform_documentation():
    reform_json = """
    {
    "policy": {
      "_II_em_cpi": {"2016": false,
                     "2018": true},
      "_II_em": {"2016": [5000],
                 "2018": [6000],
                 "2020": [7000]},
      "_EITC_indiv": {"2017": [true]},
      "_STD_Aged_cpi": {"2016": false},
      "_STD_Aged": {"2016": [[1600, 1300, 1300, 1600, 1600]],
                    "2020": [[2000, 2000, 2000, 2000, 2000]]},
      "_ID_BenefitCap_Switch_medical": {"2020": [false]},
      "_ID_BenefitCap_Switch_casualty": {"2020": [false]},
      "_ID_BenefitCap_Switch_misc": {"2020": [false]},
      "_ID_BenefitCap_Switch_interest": {"2020": [false]},
      "_ID_BenefitCap_Switch_charity": {"2020": [false]}
      }
    }
    """
    assump_json = """
    {
    "consumption": {},
    "behavior": {},
    // increase baseline inflation rate by one percentage point in 2014+
    // (has no effect on known policy parameter values)
    "growdiff_baseline": {"_ACPIU": {"2014": [0.01]}},
    "growdiff_response": {},
    "growmodel": {}
    }
    """
    params = Calculator.read_json_param_objects(reform_json, assump_json)
    assert isinstance(params, dict)
    doc = Calculator.reform_documentation(params)
    assert isinstance(doc, str)
    dump = False  # set to True to print documentation and force test failure
    if dump:
        print(doc)
        assert 1 == 2