Exemplo n.º 1
0
def test_not_implemented_scheme():
    """Check NotImplementedError is raised if the scheme is unknown."""

    with nose.tools.assert_raises(NotImplementedError):
        # Bad year
        costs.calculate_cost(100, -1000, costs.Scheme.USS)

    with nose.tools.assert_raises(NotImplementedError):
        # Bad year
        costs.calculate_cost(100, 2018, 'this-is-not-a-pension-scheme')
Exemplo n.º 2
0
def test_mrc_2018():
    """Check on-costs are returned for MRC."""
    # We have no ground truth for MRC unfortunately so we check that NotImplementedError is not
    # raised and a result is returned.
    result = costs.calculate_cost(40000, costs.Scheme.MRC, 2018)
    nose.tools.assert_equal(result.salary, 40000)
    nose.tools.assert_greater(result.total, result.salary)
Exemplo n.º 3
0
def test_default_scheme():
    """Check on-costs for default scheme and year"""
    with mock.patch('ucamstaffoncosts.costs._LATEST_TAX_YEAR', 2018):
        assert_generator_matches_table(
            lambda s: costs.calculate_cost(s, costs.Scheme.NHS),
            'nhs_2018.csv',
            with_exchange_column=True)
Exemplo n.º 4
0
def test_nhs_2018():
    """Check on-costs if employee has a NHS scheme."""
    assert_generator_matches_table(
        lambda s: costs.calculate_cost(s, costs.Scheme.NHS, 2018),
        'nhs_2018.csv',
        with_exchange_column=True)
Exemplo n.º 5
0
def test_cps_pre_2013_exchange():
    """Check on-costs if employee has a CPS pre-2013 scheme with salary exchange."""
    assert_generator_matches_table(lambda s: costs.calculate_cost(
        s, costs.Scheme.CPS_PRE_2013_EXCHANGE, 2018),
                                   'cps_exchange_pre_2013.csv',
                                   with_exchange_column=True)
Exemplo n.º 6
0
def test_cps_hybrid_2018_exchange():
    """Check on-costs if employee has a CPS hybrid scheme with salary exchange."""
    assert_generator_matches_table(lambda s: costs.calculate_cost(
        s, costs.Scheme.CPS_HYBRID_EXCHANGE, 2018),
                                   'cps_hybrid_exchange_2018.csv',
                                   with_exchange_column=True)
Exemplo n.º 7
0
def test_uss_2018_exchange():
    """Check on-costs if employee has a USS scheme with salary exchange."""
    assert_generator_matches_table(
        lambda s: costs.calculate_cost(s, costs.Scheme.USS_EXCHANGE, 2018),
        'uss_exchange_2018.csv',
        with_exchange_column=True)
Exemplo n.º 8
0
def test_uss_2018():
    """Check on-costs if employee has a USS scheme."""
    assert_generator_matches_table(
        lambda s: costs.calculate_cost(s, costs.Scheme.USS, 2018),
        'uss_2018.csv')
Exemplo n.º 9
0
def test_no_scheme_2018():
    """Check on-costs if employee has no pension scheme."""
    assert_generator_matches_table(
        lambda s: costs.calculate_cost(s, costs.Scheme.NONE, 2018),
        'no_scheme_2018.csv',
        with_exchange_column=True)