Previous topic

mmf.utils.examples

Next topic

mmf.utils.init

This Page

mmf.utils.examples.mmf_test_example

Complex(*varargin, **kwargs) A simple class representing complex numbers.

Inheritance diagram for mmf.utils.examples.mmf_test_example:

Inheritance diagram of mmf.utils.examples.mmf_test_example

Simple example module to demonstrate the testing framework.

See also the unit tests in the tests directory.

class mmf.utils.examples.mmf_test_example.Complex(*varargin, **kwargs)[source]

Bases: mmf.objects.StateVars

A simple class representing complex numbers.

Complex(real=0,
        imag=0)

This is not a good example of a real class, but allows us to demonstrate some features of the testing framework.

Examples

Here are some doctests demonstrating the usage:

>>> c = Complex(real=0, imag=1)
>>> c
Complex(imag=1)
>>> c*c
Complex(real=-1)

Attributes