Resolutions API
These are the Resolutions included in ScreenPy.
ContainsItemMatching
Aliases: ContainItemMatching
ContainsTheEntry
Aliases: ContainsTheEntries
,
ContainTheEntries
,
ContainTheEntry
,
- class ContainsTheEntry(**kv_args: V)
- class ContainsTheEntry(kv_args: Mapping[K, V] | list[tuple[K, V]])
- class ContainsTheEntry(*kv_args: V)
Match a dictionary containing the specified key/value pair(s).
Examples:
the_actor.should( See.the( HeadersOfTheLastResponse(), ContainTheEntry(Authorization="Bearer 1") ) ) the_actor.should( See.the( EnglishDictionary(), ContainsTheEntry({"Python": "a large snake."}) ) ) the_actor.should(See.the(MathTestAnswers(), ContainsTheEntry("Problem3", 45)))
ContainsTheItem
Aliases: ContainTheItem
- class ContainsTheItem(item: T)
Match an iterable containing a specific item.
Examples:
the_actor.should( See.the(Text.of_all(SEARCH_RESULTS), ContainsTheItem("The Droids")) )
ContainsTheKey
Aliases: ContainTheKey
- class ContainsTheKey(key: K)
Match a dictionary containing a specific key.
Examples:
the_actor.should(See.the(LastResponseBody(), ContainsTheKey("skeleton")))
ContainsTheText
Aliases: ContainTheText
ContainsTheValue
Aliases: ContainTheValue
- class ContainsTheValue(value: V)
Match a dictionary containing a specific value.
Examples:
the_actor.should( See.the(Cookies(), ContainTheValue("pumpernickle")) )
EndsWith
Aliases: EndWith
HasLength
Aliases: HaveLength
IsCloseTo
Aliases: CloseTo
IsEmpty
Aliases: Empty
- class IsEmpty
Match on an empty collection.
Examples:
the_actor.should(See.the(List.of_all(VIDEO_FRAMES), IsEmpty()))
IsEqualTo
Aliases: Equals
,
Equal
,
EqualTo
,
IsEqual
IsGreaterThan
Aliases: GreaterThan
IsGreaterThanOrEqualTo
Aliases: GreaterThanOrEqualTo
IsInRange
Aliases: InRange
- class IsInRange(*bounds: int | str)
Match on a number within a given range.
By default, this Resolution assumes an inclusive range (i.e. [x, y]) if no brackets are used in the range string or if numbers are used.
Examples:
the_actor.should( See.the(Number.of(ADVERTISEMENT_BANNERS), IsInRange(1, 5)) ) the_actor.should( See.the(Number.of(ADVERTISEMENT_BANNERS), IsInRange("(1, 5)")) ) the_actor.should(See.the(Number.of(PUPPY_PICTURES), IsInRange("1-5"))) the_actor.should(See.the(Number.of(COOKIES), IsInRange("[1, 5)")))
IsLessThan
Aliases: LessThan
IsLessThanOrEqualTo
Aliases: LessThanOrEqualTo
IsNot
Aliases: DoesNot
,
DoNot
- class IsNot(resolution: Resolvable)
Match a negated Resolution.
Examples:
the_actor.should(See.the(Element(WELCOME_BANNER), IsNot(Visible())))
Matches
Aliases: Match
ReadsExactly
Aliases: ReadExactly
StartsWith
Aliases: StartWith
BaseResolution
- class BaseResolution(*args: object, **kwargs: object)
Base class for Resolutions, ScreenPy’s “expected value”.
An abstraction barrier for PyHamcrest’s matchers. Allows for natural language assertions and hooks into ScreenPy’s logging framework.
You probably shouldn’t expect to call any of the defined methods on this class or any inherited classes. Just pass an instantiated Resolution to your Actor, they’ll know what to do with it.