(self)
| 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 [ |
nothing calls this directly
no test coverage detected