Robot Framework
robot.utils.asserts Namespace Reference

Functions

def _format_message (obj1, obj2, delim, formatter=safe_str)
 
def _report_failure (msg)
 
def _report_inequality (obj1, obj2, delim, msg=None, values=False, formatter=safe_str, extra=None)
 
def assert_almost_equal (first, second, places=7, msg=None, values=True)
 Fail if the two objects are unequal after rounded to given places. More...
 
def assert_equal (first, second, msg=None, values=True, formatter=safe_str)
 Fail if given objects are unequal as determined by the '==' operator. More...
 
def assert_false (expr, msg=None)
 Fail the test if the expression is True. More...
 
def assert_none (obj, msg=None, values=True)
 Fail the test if given object is not None. More...
 
def assert_not_almost_equal (first, second, places=7, msg=None, values=True)
 Fail if the two objects are unequal after rounded to given places. More...
 
def assert_not_equal (first, second, msg=None, values=True, formatter=safe_str)
 Fail if given objects are equal as determined by the '==' operator. More...
 
def assert_not_none (obj, msg=None, values=True)
 Fail the test if given object is None. More...
 
def assert_raises (exc_class, callable_obj, *args, **kwargs)
 Fail unless an exception of class exc_class is thrown by callable_obj. More...
 
def assert_raises_with_msg (exc_class, expected_msg, callable_obj, *args, **kwargs)
 Similar to fail_unless_raises but also checks the exception message. More...
 
def assert_true (expr, msg=None)
 Fail the test unless the expression is True. More...
 
def fail (msg=None)
 Fail test immediately with the given message. More...
 

Function Documentation

◆ _format_message()

def robot.utils.asserts._format_message (   obj1,
  obj2,
  delim,
  formatter = safe_str 
)
private

Definition at line 239 of file asserts.py.

◆ _report_failure()

def robot.utils.asserts._report_failure (   msg)
private

Definition at line 222 of file asserts.py.

◆ _report_inequality()

def robot.utils.asserts._report_inequality (   obj1,
  obj2,
  delim,
  msg = None,
  values = False,
  formatter = safe_str,
  extra = None 
)
private

Definition at line 228 of file asserts.py.

◆ assert_almost_equal()

def robot.utils.asserts.assert_almost_equal (   first,
  second,
  places = 7,
  msg = None,
  values = True 
)

Fail if the two objects are unequal after rounded to given places.

inequality is determined by object's difference rounded to the
given number of decimal places (default 7) and comparing to zero.
Note that decimal places (from zero) are usually not the same as
significant digits (measured from the most significant digit).

Definition at line 203 of file asserts.py.

◆ assert_equal()

def robot.utils.asserts.assert_equal (   first,
  second,
  msg = None,
  values = True,
  formatter = safe_str 
)

Fail if given objects are unequal as determined by the '==' operator.

Definition at line 185 of file asserts.py.

◆ assert_false()

def robot.utils.asserts.assert_false (   expr,
  msg = None 
)

Fail the test if the expression is True.

Definition at line 107 of file asserts.py.

◆ assert_none()

def robot.utils.asserts.assert_none (   obj,
  msg = None,
  values = True 
)

Fail the test if given object is not None.

Definition at line 133 of file asserts.py.

◆ assert_not_almost_equal()

def robot.utils.asserts.assert_not_almost_equal (   first,
  second,
  places = 7,
  msg = None,
  values = True 
)

Fail if the two objects are unequal after rounded to given places.

Equality is determined by object's difference rounded to to the
given number of decimal places (default 7) and comparing to zero.
Note that decimal places (from zero) are usually not the same as
significant digits (measured from the most significant digit).

Definition at line 216 of file asserts.py.

◆ assert_not_equal()

def robot.utils.asserts.assert_not_equal (   first,
  second,
  msg = None,
  values = True,
  formatter = safe_str 
)

Fail if given objects are equal as determined by the '==' operator.

Definition at line 191 of file asserts.py.

◆ assert_not_none()

def robot.utils.asserts.assert_not_none (   obj,
  msg = None,
  values = True 
)

Fail the test if given object is None.

Definition at line 119 of file asserts.py.

◆ assert_raises()

def robot.utils.asserts.assert_raises (   exc_class,
  callable_obj,
args,
**  kwargs 
)

Fail unless an exception of class exc_class is thrown by callable_obj.

callable_obj is invoked with arguments args and keyword arguments
kwargs. If a different type of exception is thrown, it will not be
caught, and the test case will be deemed to have suffered an
error, exactly as for an unexpected exception.

If a correct exception is raised, the exception instance is returned
by this method.

Definition at line 156 of file asserts.py.

◆ assert_raises_with_msg()

def robot.utils.asserts.assert_raises_with_msg (   exc_class,
  expected_msg,
  callable_obj,
args,
**  kwargs 
)

Similar to fail_unless_raises but also checks the exception message.

Definition at line 170 of file asserts.py.

◆ assert_true()

def robot.utils.asserts.assert_true (   expr,
  msg = None 
)

Fail the test unless the expression is True.

Definition at line 113 of file asserts.py.

◆ fail()

def robot.utils.asserts.fail (   msg = None)

Fail test immediately with the given message.

Definition at line 102 of file asserts.py.