MCPcopy Create free account
hub / github.com/apify/crawlee-python / test_parse_from_content

Function test_parse_from_content

tests/unit/_utils/test_robots.py:74–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72
73
74async def test_parse_from_content() -> None:
75 content = """User-agent: *
76 Disallow: *deny_all/
77 crawl-delay: 10
78 User-agent: Googlebot
79 Disallow: *deny_googlebot/"""
80 robots = await RobotsTxtFile.from_content('http://not-exists.com/robots.txt', content)
81 assert robots.is_allowed('http://not-exists.com/something/page.html')
82 assert robots.is_allowed('http://not-exists.com/deny_googlebot/page.html')
83 assert not robots.is_allowed('http://not-exists.com/deny_googlebot/page.html', 'Googlebot')
84 assert not robots.is_allowed('http://not-exists.com/deny_all/page.html')
85
86
87async def test_bind_robots_txt_url() -> None:

Callers

nothing calls this directly

Calls 2

from_contentMethod · 0.80
is_allowedMethod · 0.80

Tested by

no test coverage detected