mirror of
https://github.com/lilydjwg/nvchecker
synced 2024-12-24 07:32:40 +00:00
36 lines
861 B
Python
36 lines
861 B
Python
# MIT licensed
|
|
# Copyright (c) 2021 ypsilik <tt2laurent.maud@gmail.com>, et al.
|
|
|
|
import pytest
|
|
|
|
lxml_available = True
|
|
try:
|
|
import lxml
|
|
except ImportError:
|
|
lxml_available = False
|
|
|
|
pytestmark = [
|
|
pytest.mark.asyncio(scope="session"),
|
|
pytest.mark.needs_net,
|
|
pytest.mark.skipif(not lxml_available, reason="needs lxml"),
|
|
]
|
|
|
|
async def test_xpath_ok(get_version):
|
|
ver = await get_version("aur", {
|
|
"source": "htmlparser",
|
|
"url": "https://aur.archlinux.org/",
|
|
"xpath": '//div[@id="footer"]/p[1]/a/text()',
|
|
})
|
|
assert ver.startswith('v')
|
|
assert '.' in ver
|
|
|
|
async def test_xpath_element(get_version):
|
|
ver = await get_version("aur", {
|
|
"source": "htmlparser",
|
|
"url": "https://aur.archlinux.org/",
|
|
"xpath": '//div[@id="footer"]/p[1]/a',
|
|
})
|
|
assert ver.startswith('v')
|
|
assert '.' in ver
|
|
|