(self, url, attr, expected_frag, func)
| 1142 | )) |
| 1143 | @support.subTests('func', (urllib.parse.urlparse, urllib.parse.urlsplit)) |
| 1144 | def test_parse_fragments(self, url, attr, expected_frag, func): |
| 1145 | # Exercise the allow_fragments parameter of urlparse() and urlsplit() |
| 1146 | if attr == "params" and func is urllib.parse.urlsplit: |
| 1147 | attr = "path" |
| 1148 | result = func(url, allow_fragments=False) |
| 1149 | self.assertEqual(result.fragment, "") |
| 1150 | self.assertEndsWith(getattr(result, attr), |
| 1151 | "#" + expected_frag) |
| 1152 | self.assertEqual(func(url, "", False).fragment, "") |
| 1153 | |
| 1154 | result = func(url, allow_fragments=True) |
| 1155 | self.assertEqual(result.fragment, expected_frag) |
| 1156 | self.assertNotEndsWith(getattr(result, attr), expected_frag) |
| 1157 | self.assertEqual(func(url, "", True).fragment, |
| 1158 | expected_frag) |
| 1159 | self.assertEqual(func(url).fragment, expected_frag) |
| 1160 | |
| 1161 | def test_mixed_types_rejected(self): |
| 1162 | # Several functions that process either strings or ASCII encoded bytes |
nothing calls this directly
no test coverage detected