Skip to content

Container matchers

DictContainingKeys

Matches any dictionary containing all the given keys

Parameters:

Name Type Description Default
keys set

set of keys to match

required

DictContainingValues

Matches any dictionary containing all the given values

Parameters:

Name Type Description Default
values list

list of values to match

required

DictContainingItems

Matches any dictionary containing all the given items, where an item is a key-value pair.

Parameters:

Name Type Description Default
items dict

dict of items to match

required

ListContaining

Matches any list containing all the given items

Parameters:

Name Type Description Default
items list

items to check for

required

ListContainingOnly

ListOfLength

Matches any list of a given length

Parameters:

Name Type Description Default
length int

the expected length of the list

required

Raises:

Type Description
ValueError

length is < 0

SetContaining

Matches any set containing all the given items

Parameters:

Name Type Description Default
items set

items to check for

required

ObjectContainingProperties

Matches any object containing all the given properties. Note that this does not check property values - just the presence of those properties.

Parameters:

Name Type Description Default
properties set

set of properties to match

required

ObjectContainingItems

Matches any object containing all the given items, where an item is a property-value pair.

Parameters:

Name Type Description Default
items dict

dict of items to match

required