Example #1
0
def test_A1967_70_horizontal_read_correctly():
    """ The examps A1967-70 table uses Lx and horizontal layout """
    table = A1967_70_Exams()
    # select mortality
    q30 = table.qx(30)
    assert q30[0] == pytest.approx(0.00043767,
                                   abs=0.00000001)  # Select mortality
    assert q30[4] == pytest.approx(0.00079004,
                                   abs=0.00000001)  # Ultimate mortality
    # ultimate mortality
    q30 = table.qx(30, select=False)
    assert q30[0] == pytest.approx(0.00065368,
                                   abs=0.00000001)  # Ultimate mortality
    assert q30[4] == pytest.approx(0.00079004,
                                   abs=0.00000001)  # Ultimate mortality
import pytest
from actymath import Calc
from actymath.tables import A1967_70_Exams

# A1967-70 table - Actuarial Green tables for testing
table = A1967_70_Exams()
q0 = table.qx(0, select=True)

# Create calc
calc = Calc()
calc.add_life(0, q0)
calc.add_i(rate=0.04)  # Will use 4% tables

# Set the l(x) with the right base for the tables
calc.populate("l(x1)")


def test_a_due_x1():
    calc.populate("a_due(x1)")
    assert calc["a_due(x1)"].iloc[0] == pytest.approx(24.240, abs=0.001)
    assert calc["a_due(x1)"].iloc[54] == pytest.approx(14.672, abs=0.001)


def test_a_x1():
    calc.populate("a(x1)")
    assert calc["a(x1)"].iloc[53] == pytest.approx(14.672 * 3840.1664 /
                                                   4020.9326,
                                                   abs=0.001)


def test_A_x1():
Example #3
0
def get_qx():
    table = A1967_70_Exams()
    q30 = table.qx(30, select=True)
    return q30