MCPcopy
hub / github.com/httpie/cli / assert_output_matches

Function assert_output_matches

tests/utils/matching/__init__.py:21–30  ·  view source on GitHub ↗

r""" Check the command `output` for an exact full sequence of `tokens`. >>> out = 'GET / HTTP/1.1\r\nAAA:BBB\r\n\r\nCCC\n\n' >>> assert_output_matches(out, [Expect.REQUEST_HEADERS, Expect.BODY, Expect.SEPARATOR])

(output: str, tokens: Iterable[Expect])

Source from the content-addressed store, hash-verified

19
20
21def assert_output_matches(output: str, tokens: Iterable[Expect]):
22 r"""
23 Check the command `output` for an exact full sequence of `tokens`.
24
25 >>> out = 'GET / HTTP/1.1\r\nAAA:BBB\r\n\r\nCCC\n\n'
26 >>> assert_output_matches(out, [Expect.REQUEST_HEADERS, Expect.BODY, Expect.SEPARATOR])
27
28 """
29 # TODO: auto-remove ansi colors to allow for testing of colorized output as well.
30 expect_tokens(tokens=tokens, s=output)
31
32
33def assert_output_does_not_match(output: str, tokens: Iterable[Expect]):

Calls 1

expect_tokensFunction · 0.85