MCPcopy Index your code
hub / github.com/python/cpython / _test

Method _test

Lib/test/test_webbrowser.py:270–299  ·  view source on GitHub ↗
(self, meth, **kwargs)

Source from the content-addressed store, hash-verified

268 webbrowser.objc = self.orig_objc
269
270 def _test(self, meth, **kwargs):
271 # The browser always gets focus, there's no concept of separate browser
272 # windows, and there's no API-level control over creating a new tab.
273 # Therefore, all calls to webbrowser are effectively the same.
274 getattr(webbrowser, meth)(URL, **kwargs)
275
276 # The ObjC String version of the URL is created with UTF-8 encoding
277 url_string_args = [
278 "C#NSString",
279 "S#stringWithCString:encoding:",
280 b'https://www.example.com',
281 4,
282 ]
283 # The NSURL version of the URL is created from that string
284 url_obj_args = [
285 "C#NSURL",
286 "S#URLWithString:",
287 self._obj_ref(*url_string_args),
288 ]
289 # The openURL call is invoked on the shared application
290 shared_app_args = ["C#UIApplication", "S#sharedApplication"]
291
292 # Verify that the last call is the one that opens the URL.
293 webbrowser.objc.objc_msgSend.assert_called_with(
294 self._obj_ref(*shared_app_args),
295 "S#openURL:options:completionHandler:",
296 self._obj_ref(*url_obj_args),
297 None,
298 None
299 )
300
301 def test_open(self):
302 self._test('open')

Callers 15

test_openMethod · 0.95
test_open_newMethod · 0.95
test_open_new_tabMethod · 0.95
test_openMethod · 0.45
test_openMethod · 0.45
test_openMethod · 0.45
test_open_newMethod · 0.45
test_open_new_tabMethod · 0.45
test_openMethod · 0.45

Calls 2

_obj_refMethod · 0.95
assert_called_withMethod · 0.80

Tested by

no test coverage detected