joythief.strings module¶
Matchers for the text sequence type (str).
- class joythief.strings.JsonString(expected=<object object>)[source]¶
-
Matches any
strinstance representing JSON.- Parameters:
expected (Any) – What the result of parsing the JSON should be. If omitted, any valid JSON string is matched.
- class joythief.strings.StringMatching(pattern: Pattern[str])[source]¶
- class joythief.strings.StringMatching(pattern: str, *, flags: int = 0)
-
Matches any
strinstance matching a regular expression.- Parameters:
- Raises:
ValueError – if flags are provided with a pre-compiled pattern.
- classmethod iso8601()[source]¶
Create a matcher for strings representing ISO 8601 timestamps.
Matches the
%Y-%m-%dT%H:%M:%S.%fformat as created by e.g.datetime.datetime.isoformat():'2025-07-22T14:16:48.708298'Note the match is only on structure, it does not attempt to validate the actual datetime represented by the string.
- class joythief.strings.UrlString(*, scheme=None, hostname=None, path=None, query=None)[source]¶
-
Matches any
strinstance representing a URL.The string is parsed with
urlparse()and compared attribute-by-attribute. Any attributes not provided are ignored.- Parameters:
- Raises:
TypeError – if no arguments are provided.