expyct.any module

class expyct.any.Any(map_before: Optional[Callable] = None, optional: Optional[bool] = None, equals: Optional[Any] = None, vars: Optional[Any] = None, satisfies: Optional[Callable[[Any], bool]] = None, type: Optional[Type] = None, instance_of: Optional[Type] = None)

Bases: expyct.base.Instance, expyct.base.Satisfies, expyct.base.Vars, expyct.base.Equals[Any], expyct.base.Optional, expyct.base.MapBefore, expyct.base.BaseMatcher

Match any object.

Parameters
  • map_before – apply function before checking equality

  • optional – whether None is allowed [default: False]

  • equals – object must equal exactly. This is useful together with map_before to check a value after applying a function

  • vars – object attributes (result of vars()) must equal

  • satisfies – object must satisfy predicate

  • type – type of object must equal to given type

  • instance_of – object must be an instance of given type

class expyct.any.AnyType(map_before: Optional[Callable] = None, optional: Optional[bool] = None, equals: Optional[Any] = None, vars: Optional[Any] = None, satisfies: Optional[Callable[[Any], bool]] = None, superclass_of: Optional[Type] = None, subclass_of: Optional[Type] = None)

Bases: expyct.base.Type, expyct.base.Satisfies, expyct.base.Vars, expyct.base.Equals[Any], expyct.base.Optional, expyct.base.MapBefore, expyct.base.BaseMatcher

Match any class.

Parameters
  • map_before – apply function before checking equality

  • optional – whether None is allowed [default: False]

  • equals – object must equal exactly. This is useful together with map_before to check a value after applying a function

  • vars – object attributes (result of vars()) must equal

  • satisfies – object must satisfy predicate

  • superclass_of – class must be superclass of given type

  • subclass_of – class must be subclass of given type

class expyct.any.AnyValue(map_before: Optional[Callable] = None, optional: Optional[bool] = None, equals: Optional[Any] = None, vars: Optional[Any] = None, satisfies: Optional[Callable[[Any], bool]] = None, type: Optional[Type] = None, instance_of: Optional[Type] = None)

Bases: expyct.base.Instance, expyct.base.Satisfies, expyct.base.Vars, expyct.base.Equals[Any], expyct.base.Optional, expyct.base.MapBefore, expyct.base.BaseMatcher

Match any value.

Parameters
  • map_before – apply function before checking equality

  • optional – whether None is allowed [default: False]

  • equals – object must equal exactly. This is useful together with map_before to check a value after applying a function

  • vars – object attributes (result of vars()) must equal

  • satisfies – object must satisfy predicate

  • type – type of object must equal to given type

  • instance_of – object must be an instance of given type

expyct.any.ANY = expyct.Instance()

Literally anything

expyct.any.ANY_TYPE = expyct.AnyType()

Any type (i.e. class)

expyct.any.ANY_VALUE = expyct.Instance()

Any value