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
b7536d58
Kaydet (Commit)
b7536d58
authored
Eyl 24, 2000
tarafından
Lars Gustäbel
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added test cases for the InputSource class.
üst
b49f88bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
2 deletions
+55
-2
test_sax
Lib/test/output/test_sax
+4
-1
test_sax.py
Lib/test/test_sax.py
+51
-1
No files found.
Lib/test/output/test_sax
Dosyayı görüntüle @
b7536d58
...
...
@@ -6,6 +6,9 @@ Passed test_escape_basic
Passed test_escape_extra
Passed test_expat_attrs_empty
Passed test_expat_attrs_wattr
Passed test_expat_inpsource_filename
Passed test_expat_inpsource_stream
Passed test_expat_inpsource_sysid
Passed test_expat_nsattrs_empty
Passed test_expat_nsattrs_wattr
Passed test_filter_basic
...
...
@@ -17,4 +20,4 @@ Passed test_xmlgen_content_escape
Passed test_xmlgen_ignorable
Passed test_xmlgen_ns
Passed test_xmlgen_pi
18
tests, 0 failures
21
tests, 0 failures
Lib/test/test_sax.py
Dosyayı görüntüle @
b7536d58
...
...
@@ -4,7 +4,7 @@
from
xml.sax.saxutils
import
XMLGenerator
,
escape
,
XMLFilterBase
from
xml.sax.expatreader
import
create_parser
from
xml.sax.xmlreader
import
AttributesImpl
,
AttributesNSImpl
from
xml.sax.xmlreader
import
InputSource
,
AttributesImpl
,
AttributesNSImpl
from
xml.sax.handler
import
ContentHandler
from
cStringIO
import
StringIO
from
test_support
import
verbose
,
TestFailed
...
...
@@ -238,6 +238,42 @@ def test_expat_nsattrs_wattr():
attrs
.
getValue
((
ns_uri
,
"attr"
))
==
"val"
and
\
attrs
[(
ns_uri
,
"attr"
)]
==
"val"
# ===== InputSource support
xml_test_out
=
open
(
"test.xml.out"
)
.
read
()
def
test_expat_inpsource_filename
():
parser
=
create_parser
()
result
=
StringIO
()
xmlgen
=
XMLGenerator
(
result
)
parser
.
setContentHandler
(
xmlgen
)
parser
.
parse
(
"test.xml"
)
return
result
.
getvalue
()
==
xml_test_out
def
test_expat_inpsource_sysid
():
parser
=
create_parser
()
result
=
StringIO
()
xmlgen
=
XMLGenerator
(
result
)
parser
.
setContentHandler
(
xmlgen
)
parser
.
parse
(
InputSource
(
"test.xml"
))
return
result
.
getvalue
()
==
xml_test_out
def
test_expat_inpsource_stream
():
parser
=
create_parser
()
result
=
StringIO
()
xmlgen
=
XMLGenerator
(
result
)
parser
.
setContentHandler
(
xmlgen
)
inpsrc
=
InputSource
()
inpsrc
.
setByteStream
(
open
(
"test.xml"
))
parser
.
parse
(
inpsrc
)
return
result
.
getvalue
()
==
xml_test_out
# ===========================================================================
#
# xmlreader tests
...
...
@@ -383,6 +419,18 @@ def test_nsattrs_wattr():
# ===== Main program
def
make_test_output
():
parser
=
create_parser
()
result
=
StringIO
()
xmlgen
=
XMLGenerator
(
result
)
parser
.
setContentHandler
(
xmlgen
)
parser
.
parse
(
"test.xml"
)
outf
=
open
(
"test.xml.out"
,
"w"
)
outf
.
write
(
result
.
getvalue
())
outf
.
close
()
items
=
locals
()
.
items
()
items
.
sort
()
for
(
name
,
value
)
in
items
:
...
...
@@ -392,3 +440,5 @@ for (name, value) in items:
print
"
%
d tests,
%
d failures"
%
(
tests
,
fails
)
if
fails
!=
0
:
raise
TestFailed
,
"
%
d of
%
d tests failed"
%
(
fails
,
tests
)
make_test_output
()
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