Ejemplo n.º 1
0
def test_complex_sub_complex():
    c1 = complex(4, 2) - complex(2, 1)
    c2 = Complex(4, 2) - Complex(2, 1)

    c1_repr = c1.real, c1.imag
    c2_repr = c2.r, c2.i

    assert c1_repr == c2_repr
Ejemplo n.º 2
0
def test_complex_addition_complex():
    c1 = complex(4, 2) + complex(2, 1)
    c2 = Complex(4, 2) + Complex(2, 1)

    c1_repr = c1.real, c1.imag
    c2_repr = c2.r, c2.i

    assert c1_repr == c2_repr
Ejemplo n.º 3
0
def test_complex_div_real():
    c1 = complex(4, 2) / 2
    c2 = Complex(4, 2) / 2

    c1_repr = c1.real, c1.imag
    c2_repr = c2.r, c2.i

    assert c1_repr == c2_repr
Ejemplo n.º 4
0
def test_complex_mul_real():
    c1 = complex(4, 2) * 21
    c2 = Complex(4, 2) * 21

    c1_repr = c1.real, c1.imag
    c2_repr = c2.r, c2.i

    assert c1_repr == c2_repr
Ejemplo n.º 5
0
def test_complex_sub_real():
    c1 = complex(4, 2) - 3
    c2 = Complex(4, 2) - 3

    c1_repr = c1.real, c1.imag
    c2_repr = c2.r, c2.i

    assert c1_repr == c2_repr
Ejemplo n.º 6
0
def test_complex_instanciation():
    c1 = complex(4, 2)
    c2 = Complex(4, 2)

    c1_repr = c1.real, c1.imag
    c2_repr = c2.r, c2.i

    assert c1_repr == c2_repr