Ejemplo n.º 1
0
def test_q2_printed(q2):
    """Is this Quotient correctly printed?"""
    assert q2.printed == wrap_nb('-\\frac{1}{2}\div \\frac{1}{3}')
Ejemplo n.º 2
0
def test_0_display(v0):
    """Is the value correctly displayed?"""
    assert str(v0) == wrap_nb('4')
Ejemplo n.º 3
0
def test_negv_display(negv):
    """Is the value correctly displayed?"""
    assert str(negv) == wrap_nb('-4.2')
Ejemplo n.º 4
0
def test_1_display():
    """Is Item(1) correctly printed?"""
    assert Item(1).printed == wrap_nb('1')
def test_tup0_crossproduct_eq_AB(tup0, AB):
    """Check one of the crossproducts equations of this table."""
    assert tup0.into_crossproduct_equation(AB).printed == \
        wrap_nb('\\frac{2}{3.4}=\\frac{\\text{AB}}{8.5}')
Ejemplo n.º 6
0
def test_neg2_inside_exp_1plus0_printed():
    """Is Item(('+', -2, Sum([1, 0]))) correctly printed?"""
    assert Item(('+', -2, Sum([1, 0]))).printed == wrap_nb('-2')
Ejemplo n.º 7
0
def test_neg2_inside_exp_sum_of_sum_of_1plus1_printed():
    """Is Item(('+', -2, Sum([Sum([Sum([1, 1])])]))) correctly printed?"""
    assert Item(('+', -2, Sum([Sum([Sum([1, 1])])]))).printed == \
        wrap_nb('(-2)^{1+1}')
Ejemplo n.º 8
0
def test_eq3_autoresolution():
    """Is this Equation correctly auto-resolved?"""
    eq = Equation((Item(-6), Monomial(('+', 5, 1))), number=1)
    assert eq.auto_resolution() == wrap_nb('$(\\text{E}_{1}): $'
                                           '\[-6=5x\]'
                                           '\[x=-\\frac{6}{5}\]')
Ejemplo n.º 9
0
def test_neg1_printed():
    """Is Item(-1) correctly printed?"""
    assert Item(-1).printed == wrap_nb('-1')
Ejemplo n.º 10
0
def test_eq40_printed(eq40):
    """Is this Equation correctly printed?"""
    assert eq40.printed == wrap_nb('2=2')
Ejemplo n.º 11
0
def test_eq40_nextstep(eq40):
    """Is this Equation's next step correct?"""
    assert eq40.solve_next_step() == \
        wrap_nb('Any value of {x} is solution of the equation.'
                .format(x=eq40.variable_letter))
Ejemplo n.º 12
0
def test_eq4_autoresolution():
    """Is this Equation correctly auto-resolved?"""
    eq = Equation((Monomial(('+', 8, 1)), Item(1)), number=1)
    assert eq.auto_resolution() == wrap_nb('$(\\text{E}_{1}): $'
                                           '\[8x=1\]'
                                           '\[x=\\frac{1}{8}\]')
Ejemplo n.º 13
0
def test_q2_next_step3(q2):
    """Is this Quotient's calculation's 3rd next step correct?"""
    assert q2.calculate_next_step().calculate_next_step()\
        .calculate_next_step().printed == \
        wrap_nb('-\\frac{3}{2}')
Ejemplo n.º 14
0
def test_q2_next_step2(q2):
    """Is this Quotient's calculation's 2d next step correct?"""
    assert q2.calculate_next_step().calculate_next_step().printed == \
        wrap_nb('-\\frac{1\\times 3}{2\\times 1}')
Ejemplo n.º 15
0
def test_neg3_inside_exp_2plus5_printed(neg3_inside_exp_2plus5):
    """Is Item(('+', -3, Sum([-2, 5]))) correctly printed?"""
    assert neg3_inside_exp_2plus5.printed == wrap_nb('(-3)^{-2+5}')
Ejemplo n.º 16
0
def test_negneg1_printed(negneg1):
    """Is Item(('-', -1)) correctly printed as -(-1)?"""
    assert negneg1.printed == wrap_nb('-(-1)')
Ejemplo n.º 17
0
def test_pos2_exp_sum_neg2_inside_exp4_printed():
    """Is Item(('+', 2, Sum([Item(('+', -2, 4))]))) correctly printed?"""
    assert Item(('+', 2, Sum([Item(('+', -2, 4))]))).printed == \
        wrap_nb('2^{(-2)^{4}}')
Ejemplo n.º 18
0
def test_neg1_exp_negneg1_printed():
    """Is Item(('+', -1, Item(('-', -1)))) correctly printed?"""
    assert Item(('+', -1, Item(('-', -1)))).printed == wrap_nb('-1^{-(-1)}')
Ejemplo n.º 19
0
def test_neg2_inside_exp_sum_of_product_of_1plus0_printed():
    """Is Item(('+', -2, Sum([Product([Sum([1, 0])])]))) correctly printed?"""
    assert Item(('+', -2, Sum([Product([Sum([1, 0])])]))).printed == \
        wrap_nb('-2')
Ejemplo n.º 20
0
def test_neg1_exp2_printed():
    """Is Item(('-', 1, Item(2))) correctly printed?"""
    assert Item(('-', 1, Item(2))).printed == wrap_nb('-1^{2}')
Ejemplo n.º 21
0
def test_neg2_inside_exp_sum_of_product_of_sum_of_2_printed():
    """Is Item(('+', -2, Sum([Product([Sum([2])])]))) correctly printed?"""
    assert Item(('+', -2, Sum([Product([Sum([2])])]))).printed == \
        wrap_nb('(-2)^{2}')
Ejemplo n.º 22
0
def test_neg1_inside_exp2_printed(neg1_inside_exp2):
    """Is  Item(('+', -1, Item(2))) correctly printed?"""
    assert neg1_inside_exp2.printed == wrap_nb('(-1)^{2}')
def test_tup1_crossproduct_eq_GH(tup1, GH):
    """Check one of the crossproducts equations of this table."""
    assert tup1.into_crossproduct_equation(GH).printed == \
        wrap_nb('\\frac{2}{2.5}=\\frac{4}{\\text{GH}}')
Ejemplo n.º 24
0
def test_neg5_inside_exp0_printed(neg5_inside_exp0):
    """Is (-5)^{0} correctly printed as 1?"""
    assert neg5_inside_exp0.printed == wrap_nb('1')
def test_tup0_crossproduct_eq_MN(tup0, MN):
    """Check one of the crossproducts equations of this table."""
    assert tup0.into_crossproduct_equation(MN).printed == \
        wrap_nb('\\frac{2}{3.4}=\\frac{6}{\\text{MN}}')
Ejemplo n.º 26
0
def test_neg5_inside_exp0_printed_bis(neg5_inside_exp0):
    """Is (-5)^{0} correctly printed as (-5)^{0} when explicitely desired?"""
    assert neg5_inside_exp0.into_str(force_display_exponent_0='OK',
                                     force_expression_begins=True) == \
        wrap_nb('(-5)^{0}')
Ejemplo n.º 27
0
def test_1_display(v1):
    """Is the value correctly displayed?"""
    assert str(v1) == wrap_nb('4.2')
Ejemplo n.º 28
0
def test_pos3_exp_2plus6_printed(pos3_exp_2plus6):
    """Is Item(('+', 3, Sum([-2, 6]))) evaluated to 81?"""
    assert pos3_exp_2plus6.printed == wrap_nb('3^{-2+6}')
Ejemplo n.º 29
0
def test_fp0_step3(fp0_step3):
    """Is this Product's calculation's 3rd step correct?"""
    assert fp0_step3.printed == wrap_nb('\\frac{5}{4}')
Ejemplo n.º 30
0
def test_q1_next_step2(q1):
    """Is this Quotient's calculation's 2d next step correct?"""
    assert q1.calculate_next_step().calculate_next_step().printed == \
        wrap_nb('\\frac{8\\times 2}{9\\times 7}')