Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
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
django
Commits
6a0291bd
Kaydet (Commit)
6a0291bd
authored
Mar 22, 2014
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Tweaked strip_tags tests to pass on Python 3.3
üst
6877a9d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
test_html.py
tests/utils_tests/test_html.py
+8
-2
No files found.
tests/utils_tests/test_html.py
Dosyayı görüntüle @
6a0291bd
...
...
@@ -80,12 +80,18 @@ class TestUtilsHtml(TestCase):
(
'a<p a >b</p>c'
,
'abc'
),
(
'd<a:b c:d>e</p>f'
,
'def'
),
(
'<strong>foo</strong><a href="http://example.com">bar</a>'
,
'foobar'
),
(
'<sc<!-- -->ript>test<<!-- -->/script>'
,
'test'
),
(
'<script>alert()</script>&h'
,
'alert()&h'
),
)
for
value
,
output
in
items
:
self
.
check_output
(
f
,
value
,
output
)
# Some convoluted syntax for which parsing may differ between python versions
output
=
html
.
strip_tags
(
'<sc<!-- -->ript>test<<!-- -->/script>'
)
self
.
assertNotIn
(
'<script>'
,
output
)
self
.
assertIn
(
'test'
,
output
)
output
=
html
.
strip_tags
(
'<script>alert()</script>&h'
)
self
.
assertNotIn
(
'<script>'
,
output
)
self
.
assertIn
(
'alert()'
,
output
)
# Test with more lengthy content (also catching performance regressions)
for
filename
in
(
'strip_tags1.html'
,
'strip_tags2.txt'
):
path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
upath
(
__file__
)),
'files'
,
filename
)
...
...
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