joythief.objects module

Matchers for general object types.

class joythief.objects.Anything(*args, **kwargs)[source]

Bases: Matcher[T]

Matches anything at all.

Added in version 0.5.0.

The JoyThief version of unittest.mock.ANY.

Parameters:
  • args (tp.Any)

  • kwargs (tp.Any)

class joythief.objects.InstanceOf(type_, *, nullable=False)[source]

Bases: Matcher[T]

Matches any instance of the specified type(s).

This matcher compares the received value using isinstance(), so accepts either a single type or a tuple of types. With nullable set to True, the received value can also be None.

Originally formulated for this answer.

Parameters: