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

Support pytest 4#414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
hroncok wants to merge1 commit intohtml5lib:masterfromhroncok:pytest4
Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletionshtml5lib/tests/test_encoding.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -99,8 +99,8 @@ def test_encoding():
for filename in get_data_files("encoding"):
tests = _TestData(filename, b"data", encoding=None)
for test in tests:
yield (runParserEncodingTest,test[b'data'], test[b'encoding'])
yield (runPreScanEncodingTest,test[b'data'], test[b'encoding'])
runParserEncodingTest(test[b'data'], test[b'encoding'])
runPreScanEncodingTest(test[b'data'], test[b'encoding'])


# pylint:disable=wrong-import-position
Expand Down
14 changes: 7 additions & 7 deletionshtml5lib/tests/test_sanitizer.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,19 +67,19 @@ def test_sanitizer():
'tfoot', 'th', 'thead', 'tr', 'select']:
continue # TODO
if tag_name == 'image':
yield (runSanitizerTest,"test_should_allow_%s_tag" % tag_name,
runSanitizerTest("test_should_allow_%s_tag" % tag_name,
"<img title=\"1\"/>foo &lt;bad&gt;bar&lt;/bad&gt; baz",
"<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name))
elif tag_name == 'br':
yield (runSanitizerTest,"test_should_allow_%s_tag" % tag_name,
runSanitizerTest("test_should_allow_%s_tag" % tag_name,
"<br title=\"1\"/>foo &lt;bad&gt;bar&lt;/bad&gt; baz<br/>",
"<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name))
elif tag_name in constants.voidElements:
yield (runSanitizerTest,"test_should_allow_%s_tag" % tag_name,
runSanitizerTest("test_should_allow_%s_tag" % tag_name,
"<%s title=\"1\"/>foo &lt;bad&gt;bar&lt;/bad&gt; baz" % tag_name,
"<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name))
else:
yield (runSanitizerTest,"test_should_allow_%s_tag" % tag_name,
runSanitizerTest("test_should_allow_%s_tag" % tag_name,
"<%s title=\"1\">foo &lt;bad&gt;bar&lt;/bad&gt; baz</%s>" % (tag_name, tag_name),
"<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name))

Expand All@@ -93,15 +93,15 @@ def test_sanitizer():
attribute_value = 'foo'
if attribute_name in sanitizer.attr_val_is_uri:
attribute_value = '%s://sub.domain.tld/path/object.ext' % sanitizer.allowed_protocols[0]
yield (runSanitizerTest,"test_should_allow_%s_attribute" % attribute_name,
runSanitizerTest("test_should_allow_%s_attribute" % attribute_name,
"<p %s=\"%s\">foo &lt;bad&gt;bar&lt;/bad&gt; baz</p>" % (attribute_name, attribute_value),
"<p %s='%s'>foo <bad>bar</bad> baz</p>" % (attribute_name, attribute_value))

for protocol in sanitizer.allowed_protocols:
rest_of_uri = '//sub.domain.tld/path/object.ext'
if protocol == 'data':
rest_of_uri = 'image/png;base64,aGVsbG8gd29ybGQ='
yield (runSanitizerTest,"test_should_allow_uppercase_%s_uris" % protocol,
runSanitizerTest("test_should_allow_uppercase_%s_uris" % protocol,
"<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
"""<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri))

Expand All@@ -110,7 +110,7 @@ def test_sanitizer():
if protocol == 'data':
rest_of_uri = 'image/png;base64,aGVsbG8gd29ybGQ='
protocol = protocol.upper()
yield (runSanitizerTest,"test_should_allow_uppercase_%s_uris" % protocol,
runSanitizerTest("test_should_allow_uppercase_%s_uris" % protocol,
"<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri),
"""<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri))

Expand Down
2 changes: 1 addition & 1 deletionhtml5lib/tests/test_serializer.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -222,4 +222,4 @@ def test_serializer():
with open(filename) as fp:
tests = json.load(fp)
for test in tests['tests']:
yieldrunSerializerTest,test["input"], test["expected"], test.get("options", {})
runSerializerTest(test["input"], test["expected"], test.get("options", {}))
7 changes: 4 additions & 3 deletionshtml5lib/tests/test_stream.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -308,9 +308,10 @@ def test_invalid_codepoints(inp, num):
("'\\uD800\\uD800\\uD800'", 3),
("'a\\uD800a\\uD800a\\uD800a'", 3),
("'\\uDFFF\\uDBFF'", 2),
pytest.mark.skipif(sys.maxunicode == 0xFFFF,
("'\\uDBFF\\uDFFF'", 2),
reason="narrow Python")])
pytest.param(
"'\\uDBFF\\uDFFF'", 2,
mark=pytest.mark.skipif(sys.maxunicode == 0xFFFF,
reason="narrow Python"))])
def test_invalid_codepoints_surrogates(inp, num):
inp = eval(inp) # pylint:disable=eval-used
fp = StringIO(inp)
Expand Down
2 changes: 1 addition & 1 deletionhtml5lib/tests/test_treewalkers.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -99,7 +99,7 @@ def test_treewalker_six_mix():

for tree in sorted(treeTypes.items()):
for intext, attrs, expected in sm_tests:
yieldrunTreewalkerEditTest,intext, expected, attrs, tree
runTreewalkerEditTest(intext, expected, attrs, tree)


@pytest.mark.parametrize("tree,char", itertools.product(sorted(treeTypes.items()), ["x", "\u1234"]))
Expand Down
2 changes: 1 addition & 1 deletionrequirements-test.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@ tox

flake8<3.0

pytest==3.2.5
pytest>=4.3,<4.4
coverage
pytest-expect>=1.1,<2.0
mock
2 changes: 1 addition & 1 deletiontox.ini
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
[tox]
envlist = {py27,py34,py35,py36,pypy}-{base,six19,optional}
envlist = {py27,py34,py35,py36,py37,py38,pypy}-{base,six19,optional}

[testenv]
deps =
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp