MCPcopy Index your code
hub / github.com/python-websockets/websockets / test_parse_subprotocol

Method test_parse_subprotocol

tests/test_headers.py:132–144  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

130 parse_extension(header)
131
132 def test_parse_subprotocol(self):
133 for header, parsed in [
134 # Synthetic examples
135 ("foo", ["foo"]),
136 ("foo, bar", ["foo", "bar"]),
137 # Pathological example
138 (",\t, , ,foo ,, bar,baz,,", ["foo", "bar", "baz"]),
139 ]:
140 with self.subTest(header=header):
141 self.assertEqual(parse_subprotocol(header), parsed)
142 # Also ensure that build_subprotocol round-trips cleanly.
143 unparsed = build_subprotocol(parsed)
144 self.assertEqual(parse_subprotocol(unparsed), parsed)
145
146 def test_parse_subprotocol_invalid_header(self):
147 for header in [

Callers

nothing calls this directly

Calls 2

parse_subprotocolFunction · 0.85
build_subprotocolFunction · 0.85

Tested by

no test coverage detected