MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_parse_fragments

Method test_parse_fragments

Lib/test/test_urlparse.py:1144–1159  ·  view source on GitHub ↗
(self, url, attr, expected_frag, func)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

getattrFunction · 0.85
funcFunction · 0.70
assertEqualMethod · 0.45
assertEndsWithMethod · 0.45
assertNotEndsWithMethod · 0.45

Tested by

no test coverage detected