当前位置: 首页>>代码示例>>Python>>正文


Python Calculator.reform_documentation方法代码示例

本文整理汇总了Python中taxcalc.Calculator.reform_documentation方法的典型用法代码示例。如果您正苦于以下问题:Python Calculator.reform_documentation方法的具体用法?Python Calculator.reform_documentation怎么用?Python Calculator.reform_documentation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在taxcalc.Calculator的用法示例。


在下文中一共展示了Calculator.reform_documentation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_noreform_documentation

# 需要导入模块: from taxcalc import Calculator [as 别名]
# 或者: from taxcalc.Calculator import reform_documentation [as 别名]
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
开发者ID:codykallen,项目名称:Tax-Calculator,代码行数:29,代码来源:test_calculator.py

示例2: test_reform_documentation

# 需要导入模块: from taxcalc import Calculator [as 别名]
# 或者: from taxcalc.Calculator import reform_documentation [as 别名]
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
开发者ID:andersonfrailey,项目名称:Tax-Calculator,代码行数:52,代码来源:test_calculator.py

示例3: test_reform_documentation

# 需要导入模块: from taxcalc import Calculator [as 别名]
# 或者: from taxcalc.Calculator import reform_documentation [as 别名]
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
开发者ID:codykallen,项目名称:Tax-Calculator,代码行数:43,代码来源:test_calculator.py


注:本文中的taxcalc.Calculator.reform_documentation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。