Ejemplo n.º 1
0
def test_conjugate_real_part():
    complex_number = ComplexNumber(real_value=1, imaginary_value=2)
    complex_number.conjugate()
    assert complex_number.real_value == 1
Ejemplo n.º 2
0
def test_get_conjugate_complex_number():
    complex_number = ComplexNumber(real_value=1, imaginary_value=2)
    con = complex_number.conjugate()
    assert con.real_value == 1
    assert con.imaginary_value == -2
Ejemplo n.º 3
0
>>> from complex_number import ComplexNumber
>>> one_plus_two_i = ComplexNumber(1,2)
>>> print(one_plus_two_i)
1+2i

# Task 3: Conjugate
Your ComplexNumber class should contain conjugate method that return conjugate of the complex_number

Example for conjugate:
Conjugate for complex number 1 + 2i is 1 - 2i

Your code is expected to behave as below

>>> from complex_number import ComplexNumber
>>> one_plus_two_i = ComplexNumber(1,2)
>>> one_minus_two_i = one_plus_two_i.conjugate()
>>> print(one_plus_two_i)
1+2i
>>> print(one_minus_two_i)
1-2i

# Task 4: Addition
When adding complex number instances using + operator it should return a complex number object

Example for addition:
1 + 2i + 2 + 3i = 3 + 5i

Your code is expected to behave as below

>>> from complex_number import ComplexNumber
>>> one_plus_two_i = ComplexNumber(1,2)