def test_multiple_xml_based_tax_benefit_system():
    tax_benefit_system = DummyTaxBenefitSystem()
    legislation_json = tax_benefit_system.get_legislation()
    assert legislation_json is not None
    assert isinstance(legislation_json, dict), legislation_json
    dated_legislation_json = legislations.generate_dated_legislation_json(legislation_json, "2012-01-01")
    assert isinstance(dated_legislation_json, dict), legislation_json
    compact_legislation = legislations.compact_dated_node_json(dated_legislation_json)
    assert_equal(compact_legislation.csg.activite.deductible.taux, 0.051)
    assert_equal(compact_legislation.csg.activite.crds.activite.taux, 0.005)
Пример #2
0
def test_multiple_xml_based_tax_benefit_system():
    tax_benefit_system = DummyTaxBenefitSystem()
    legislation_json = tax_benefit_system.get_legislation()
    assert legislation_json is not None
    assert isinstance(legislation_json, dict), legislation_json
    dated_legislation_json = legislations.generate_dated_legislation_json(
        legislation_json, '2012-01-01')
    assert isinstance(dated_legislation_json, dict), legislation_json
    compact_legislation = legislations.compact_dated_node_json(
        dated_legislation_json)
    assert_equal(compact_legislation.csg.activite.deductible.taux, 0.051)
    assert_equal(compact_legislation.csg.activite.crds.activite.taux, 0.005)
Пример #3
0
def test_unload_extensions():
    tbs = DummyTaxBenefitSystem()
    assert tbs.get_column('paris_logement_famille') is None
Пример #4
0
import pkg_resources
import os

from nose.tools import raises

from openfisca_core.tests.dummy_country import DummyTaxBenefitSystem

openfisca_core_dir = pkg_resources.get_distribution('OpenFisca-Core').location
dummy_extension_path = os.path.join(openfisca_core_dir, 'openfisca_core',
                                    'tests', 'dummy_extension')
tbs = DummyTaxBenefitSystem()


def test_extension_not_already_loaded():
    assert tbs.get_column('paris_logement_famille') is None


def test_load_extension():
    tbs.load_extension(dummy_extension_path)
    assert tbs.get_column('paris_logement_familles') is not None


def test_unload_extensions():
    tbs = DummyTaxBenefitSystem()
    assert tbs.get_column('paris_logement_famille') is None


@raises(IOError)
def test_failure_to_load_extension_when_directory_doesnt_exist():
    tbs.load_extension('/this/is/not/a/real/path')
Пример #5
0
# -*- coding: utf-8 -*-

import pkg_resources
import os
from nose.tools import nottest, raises

from openfisca_core.tools.test_runner import run_tests, generate_tests

from openfisca_core.tests.dummy_country import DummyTaxBenefitSystem

tax_benefit_system = DummyTaxBenefitSystem()

openfisca_core_dir = pkg_resources.get_distribution('OpenFisca-Core').location
yamls_tests_dir = os.path.join(openfisca_core_dir, 'openfisca_core', 'tests',
                               'tests_yaml')

# Declare that these two functions are not tests to run with nose
nottest(run_tests)
nottest(generate_tests)


@nottest
def run_yaml_test(file_name, options={}):
    yaml_path = os.path.join(yamls_tests_dir, '{}.yaml'.format(file_name))
    return run_tests(tax_benefit_system, yaml_path, options)


def test_success():
    run_yaml_test('test_success')

Пример #6
0
def test_unload_extensions():
    tbs = DummyTaxBenefitSystem()
    assert tbs.get_column('paris_logement_famille') is None
Пример #7
0
# -*- coding: utf-8 -*-

from nose.tools import raises

from openfisca_core.tests.dummy_country import DummyTaxBenefitSystem

tax_benefit_system = DummyTaxBenefitSystem()
scenario = tax_benefit_system.new_scenario().init_single_entity(
    parent1=dict(),
    period=2014,
)
simulation = scenario.new_simulation(trace=True)


def test_calculate_with_print_trace():
    simulation.calculate('revenu_disponible', 2014, print_trace=True)


def test_calculate_with_print_trace_and_max_depth():
    simulation.calculate('revenu_disponible',
                         2014,
                         print_trace=True,
                         max_depth=0)
    simulation.calculate('revenu_disponible',
                         2014,
                         print_trace=True,
                         max_depth=1)
    simulation.calculate('revenu_disponible',
                         2014,
                         print_trace=True,
                         max_depth=5)