expect clauses

(ExpectPy.END) or
ExpectPy.END

The end of the clauses. This is here more for consistancy, it is not needed. The end of arguments is the end of the clauses.

(ExpectPy.EXACT, string, return_value)
(ExpectPy.GLOB, glob_pattern, return_value)
(ExpectPy.REGEXP, re_pattern, return_value)
(ExpectPy.COMPILED, regexp_obj, return_value)
(ExpectPy.NULL, return_value)

return_value is any hashable object; this could also be a callback. Callable class instances must follow hash rules in the Python Reference Manual (section 3.3.1).

Examples

obj.expect(
  (ExpectPy.NULL, None)
  (ExpectPy.EXACT, "Next:\r\n", None)
  (ExpectPy.GLOB, "Object: *\r\n", 2)
  (ExpectPy.REGEXP, "Number: [1-9][0-9]*\r\n", 3)
  ExpectPy.END
)