Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
86f67123
Kaydet (Commit)
86f67123
authored
Şub 13, 2012
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix htmlparser tests to always use the right collector.
üst
5211ffe4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
test_htmlparser.py
Lib/test/test_htmlparser.py
+26
-2
No files found.
Lib/test/test_htmlparser.py
Dosyayı görüntüle @
86f67123
...
@@ -93,7 +93,7 @@ class TestCaseBase(unittest.TestCase):
...
@@ -93,7 +93,7 @@ class TestCaseBase(unittest.TestCase):
def
_parse_error
(
self
,
source
):
def
_parse_error
(
self
,
source
):
def
parse
(
source
=
source
):
def
parse
(
source
=
source
):
parser
=
html
.
parser
.
HTMLParse
r
()
parser
=
self
.
get_collecto
r
()
parser
.
feed
(
source
)
parser
.
feed
(
source
)
parser
.
close
()
parser
.
close
()
self
.
assertRaises
(
html
.
parser
.
HTMLParseError
,
parse
)
self
.
assertRaises
(
html
.
parser
.
HTMLParseError
,
parse
)
...
@@ -368,6 +368,30 @@ class HTMLParserTolerantTestCase(HTMLParserStrictTestCase):
...
@@ -368,6 +368,30 @@ class HTMLParserTolerantTestCase(HTMLParserStrictTestCase):
(
'comment'
,
'/img'
),
(
'comment'
,
'/img'
),
(
'endtag'
,
'html<'
)])
(
'endtag'
,
'html<'
)])
def
test_starttag_junk_chars
(
self
):
self
.
_run_check
(
"</>"
,
[])
self
.
_run_check
(
"</$>"
,
[(
'comment'
,
'$'
)])
self
.
_run_check
(
"</"
,
[(
'data'
,
'</'
)])
self
.
_run_check
(
"</a"
,
[(
'data'
,
'</a'
)])
# XXX this might be wrong
self
.
_run_check
(
"<a<a>"
,
[(
'data'
,
'<a'
),
(
'starttag'
,
'a'
,
[])])
self
.
_run_check
(
"</a<a>"
,
[(
'endtag'
,
'a<a'
)])
self
.
_run_check
(
"<!"
,
[(
'data'
,
'<!'
)])
self
.
_run_check
(
"<a"
,
[(
'data'
,
'<a'
)])
self
.
_run_check
(
"<a foo='bar'"
,
[(
'data'
,
"<a foo='bar'"
)])
self
.
_run_check
(
"<a foo='bar"
,
[(
'data'
,
"<a foo='bar"
)])
self
.
_run_check
(
"<a foo='>'"
,
[(
'data'
,
"<a foo='>'"
)])
self
.
_run_check
(
"<a foo='>"
,
[(
'data'
,
"<a foo='>"
)])
def
test_declaration_junk_chars
(
self
):
# XXX this is wrong
self
.
_run_check
(
"<!DOCTYPE foo $ >"
,
[(
'comment'
,
'DOCTYPE foo $ '
)])
def
test_illegal_declarations
(
self
):
# XXX this might be wrong
self
.
_run_check
(
'<!spacer type="block" height="25">'
,
[(
'comment'
,
'spacer type="block" height="25"'
)])
def
test_with_unquoted_attributes
(
self
):
def
test_with_unquoted_attributes
(
self
):
# see #12008
# see #12008
html
=
(
"<html><body bgcolor=d0ca90 text='181008'>"
html
=
(
"<html><body bgcolor=d0ca90 text='181008'>"
...
@@ -476,7 +500,7 @@ class HTMLParserTolerantTestCase(HTMLParserStrictTestCase):
...
@@ -476,7 +500,7 @@ class HTMLParserTolerantTestCase(HTMLParserStrictTestCase):
self
.
_run_check
(
html
,
expected
)
self
.
_run_check
(
html
,
expected
)
def
test_unescape_function
(
self
):
def
test_unescape_function
(
self
):
p
=
html
.
parser
.
HTMLParse
r
()
p
=
self
.
get_collecto
r
()
self
.
assertEqual
(
p
.
unescape
(
'&#bad;'
),
'&#bad;'
)
self
.
assertEqual
(
p
.
unescape
(
'&#bad;'
),
'&#bad;'
)
self
.
assertEqual
(
p
.
unescape
(
'&'
),
'&'
)
self
.
assertEqual
(
p
.
unescape
(
'&'
),
'&'
)
# see #12888
# see #12888
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment