Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbd8355a

Browse files
committed
Minor refactoring, typo fixes.
1 parent1786eb6 commitbd8355a

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

‎tests/test_requests_html.py‎

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313

1414
defget():
1515
path=os.path.sep.join((os.path.dirname(os.path.abspath(__file__)),'python.html'))
16-
url='file://{}'.format(path)
16+
url=f'file://{path}'
1717

1818
returnsession.get(url)
1919

2020

2121
@pytest.fixture
2222
defasync_get(event_loop):
23-
"""AsyncSession cannot be created global since it will create
23+
"""AsyncSession cannot be created global since it will create
2424
a different loop from pytest-asyncio. """
2525
async_session=AsyncHTMLSession()
2626
async_session.mount('file://',FileAdapter())
@@ -54,8 +54,8 @@ def test_css_selector():
5454
about=r.html.find('#about',first=True)
5555

5656
formenu_itemin (
57-
'About','Applications','Quotes','Getting Started','Help',
58-
'Python Brochure'
57+
'About','Applications','Quotes','Getting Started','Help',
58+
'Python Brochure'
5959
):
6060
assertmenu_iteminabout.text.split('\n')
6161
assertmenu_iteminabout.full_text.split('\n')
@@ -290,16 +290,24 @@ async def test_bare_js_async_eval():
290290

291291

292292
deftest_browser_session():
293-
""" Test browserinstaces is created and properly close when session is closed.
293+
""" Test browserinstances is created and properly close when session is closed.
294294
Note: session.close method need to be tested together with browser creation,
295-
sinceno doing that willleft the browser running. """
295+
sincenot doing that willleave the browser running. """
296296
session=HTMLSession()
297297
assertisinstance(session.browser,Browser)
298-
asserthasattr(session,"loop")==True
298+
asserthasattr(session,"loop")
299299
session.close()
300300
# assert count_chromium_process() == 0
301301

302302

303+
deftest_browser_process():
304+
for_inrange(3):
305+
r=get()
306+
r.html.render()
307+
308+
assertr.html.pageisNone
309+
310+
303311
@pytest.mark.asyncio
304312
asyncdeftest_browser_session_fail():
305313
""" HTMLSession.browser should not be call within an existing event loop> """
@@ -308,21 +316,9 @@ async def test_browser_session_fail():
308316
session.browser
309317

310318

311-
deftest_browser_process():
312-
for_inrange(3):
313-
r=get()
314-
r.html.render()
315-
316-
assertr.html.page==None
317-
318-
319319
@pytest.mark.asyncio
320320
asyncdeftest_async_browser_session():
321321
session=AsyncHTMLSession()
322322
browser=awaitsession.browser
323323
assertisinstance(browser,Browser)
324324
awaitsession.close()
325-
326-
327-
if__name__=='__main__':
328-
test_containing()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp