mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-16 22:10:26 +00:00
Use pytest.mark.parametrize instead of parameterized
This commit is contained in:
parent
7ae1244104
commit
86c3071405
4 changed files with 9 additions and 14 deletions
|
|
@ -92,7 +92,6 @@ version_scheme = "post-release"
|
|||
[tool.hatch.envs.test]
|
||||
dependencies = [
|
||||
"cryptography",
|
||||
"parameterized",
|
||||
"pdfminer.six",
|
||||
"pyftpdlib",
|
||||
"pyopenssl",
|
||||
|
|
|
|||
|
|
@ -20,9 +20,8 @@ Test html parsing.
|
|||
from linkcheck.htmlutil import htmlsoup
|
||||
|
||||
from io import StringIO
|
||||
import unittest
|
||||
|
||||
from parameterized import parameterized
|
||||
import pytest
|
||||
|
||||
from .htmllib import pretty_print_html
|
||||
|
||||
|
|
@ -148,12 +147,11 @@ parsetests = [
|
|||
]
|
||||
|
||||
|
||||
class TestParser(unittest.TestCase):
|
||||
class TestParser:
|
||||
"""
|
||||
Test html parser.
|
||||
"""
|
||||
|
||||
@parameterized.expand(parsetests)
|
||||
@pytest.mark.parametrize("_in, _out", parsetests)
|
||||
def test_parse(self, _in, _out):
|
||||
# Parse all test patterns in one go.
|
||||
out = StringIO()
|
||||
|
|
@ -166,7 +164,7 @@ class TestParser(unittest.TestCase):
|
|||
"""
|
||||
res = out.getvalue()
|
||||
msg = f"Test error; in: {_in!r}, out: {res!r}, expect: {_out!r}"
|
||||
self.assertEqual(res, _out, msg=msg)
|
||||
assert res == _out, msg
|
||||
|
||||
def test_encoding_detection_utf_content(self):
|
||||
html = b'<meta http-equiv="content-type" content="text/html; charset=UTF-8">'
|
||||
|
|
@ -200,4 +198,4 @@ class TestParser(unittest.TestCase):
|
|||
# Results for html without a valid charset may differ
|
||||
# based on cchardet/chardet/charset-normalizer availability.
|
||||
soup = htmlsoup.make_soup(html)
|
||||
self.assertEqual(soup.original_encoding, expected)
|
||||
assert soup.original_encoding == expected
|
||||
|
|
|
|||
|
|
@ -17,10 +17,9 @@
|
|||
Test srcset attribute parsing.
|
||||
"""
|
||||
|
||||
import unittest
|
||||
from linkcheck.htmlutil.srcsetparse import parse_srcset
|
||||
|
||||
from parameterized import parameterized
|
||||
import pytest
|
||||
|
||||
|
||||
# list of tuples
|
||||
|
|
@ -45,7 +44,7 @@ parsetests = [
|
|||
]
|
||||
|
||||
|
||||
class TestSrcsetParsing(unittest.TestCase):
|
||||
@parameterized.expand(parsetests)
|
||||
class TestSrcsetParsing:
|
||||
@pytest.mark.parametrize("_in, _urls", parsetests)
|
||||
def test_parse(self, _in, _urls):
|
||||
self.assertEqual(parse_srcset(_in), _urls)
|
||||
assert parse_srcset(_in) == _urls
|
||||
|
|
|
|||
1
tox.ini
1
tox.ini
|
|
@ -5,7 +5,6 @@ envlist = py3{9,10,11,12,13}, minreqs
|
|||
deps =
|
||||
cryptography
|
||||
pyftpdlib
|
||||
parameterized
|
||||
pyopenssl
|
||||
pytest-xdist
|
||||
pytest-cov
|
||||
|
|
|
|||
Loading…
Reference in a new issue