input: Write a function to represent a complex number in Python by defining a class with an initializer that accepts the real and imaginary parts of the number. The class should also have a string representation method to display the complex number in the format "(real + imaginaryi)". Implement the class and test cases to ensure the class works correctly.
  
  
  class ComplexNumber:
      def __init__(self, real, imaginary):
          self.real = real
          self.imaginary = imaginary
  
      def __str__(self):
          return "({0} + {1}i".format(self.real, self.imaginary)
  
  assert str(ComplexNumber(3, 4)) == "(3 + 4i)"
  assert str(ComplexNumber(-2, 5)) == "(-2 + 5i)"
  assert str(ComplexNumber(0, -1)) == "(0 - 1i)"
  assert str(ComplexNumber(1, 0)) == "(1 + 0i)"
  assert str(ComplexNumber(0, 0)) == "(0 + 0i)"
  
output: class ComplexNumber:
      def __init__(self, real, imaginary):
          self.real = real
          self.imaginary = imaginary
  
      def __str__(self):
          if self.imaginary >= 0:
              return f"({self.real} + {self.imaginary}i)"
          else:
              return f"({self.real} - {-self.imaginary}i)"