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
f3bdc108
Kaydet (Commit)
f3bdc108
authored
Eyl 07, 2015
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Backported new tests for attribute setting of expat parser.
üst
ad7b0cda
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
18 deletions
+35
-18
test_pyexpat.py
Lib/test/test_pyexpat.py
+35
-18
No files found.
Lib/test/test_pyexpat.py
Dosyayı görüntüle @
f3bdc108
...
@@ -13,27 +13,42 @@ from test.test_support import sortdict, run_unittest
...
@@ -13,27 +13,42 @@ from test.test_support import sortdict, run_unittest
class
SetAttributeTest
(
unittest
.
TestCase
):
class
SetAttributeTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
parser
=
expat
.
ParserCreate
(
namespace_separator
=
'!'
)
self
.
parser
=
expat
.
ParserCreate
(
namespace_separator
=
'!'
)
self
.
set_get_pairs
=
[
[
0
,
0
],
def
test_buffer_text
(
self
):
[
1
,
1
],
self
.
assertIs
(
self
.
parser
.
buffer_text
,
False
)
[
2
,
1
],
for
x
in
0
,
1
,
2
,
0
:
[
0
,
0
],
self
.
parser
.
buffer_text
=
x
]
self
.
assertIs
(
self
.
parser
.
buffer_text
,
bool
(
x
))
def
test_namespace_prefixes
(
self
):
self
.
assertIs
(
self
.
parser
.
namespace_prefixes
,
False
)
for
x
in
0
,
1
,
2
,
0
:
self
.
parser
.
namespace_prefixes
=
x
self
.
assertIs
(
self
.
parser
.
namespace_prefixes
,
bool
(
x
))
def
test_returns_unicode
(
self
):
def
test_returns_unicode
(
self
):
for
x
,
y
in
self
.
set_get_pairs
:
self
.
assertIs
(
self
.
parser
.
returns_unicode
,
test_support
.
have_unicode
)
for
x
in
0
,
1
,
2
,
0
:
self
.
parser
.
returns_unicode
=
x
self
.
parser
.
returns_unicode
=
x
self
.
assert
Equal
(
self
.
parser
.
returns_unicode
,
y
)
self
.
assert
Is
(
self
.
parser
.
returns_unicode
,
bool
(
x
)
)
def
test_ordered_attributes
(
self
):
def
test_ordered_attributes
(
self
):
for
x
,
y
in
self
.
set_get_pairs
:
self
.
assertIs
(
self
.
parser
.
ordered_attributes
,
False
)
for
x
in
0
,
1
,
2
,
0
:
self
.
parser
.
ordered_attributes
=
x
self
.
parser
.
ordered_attributes
=
x
self
.
assert
Equal
(
self
.
parser
.
ordered_attributes
,
y
)
self
.
assert
Is
(
self
.
parser
.
ordered_attributes
,
bool
(
x
)
)
def
test_specified_attributes
(
self
):
def
test_specified_attributes
(
self
):
for
x
,
y
in
self
.
set_get_pairs
:
self
.
assertIs
(
self
.
parser
.
specified_attributes
,
False
)
for
x
in
0
,
1
,
2
,
0
:
self
.
parser
.
specified_attributes
=
x
self
.
parser
.
specified_attributes
=
x
self
.
assertEqual
(
self
.
parser
.
specified_attributes
,
y
)
self
.
assertIs
(
self
.
parser
.
specified_attributes
,
bool
(
x
))
def
test_invalid_attributes
(
self
):
with
self
.
assertRaises
(
AttributeError
):
self
.
parser
.
foo
=
1
with
self
.
assertRaises
(
AttributeError
):
self
.
parser
.
foo
data
=
'''
\
data
=
'''
\
...
@@ -469,12 +484,14 @@ class ChardataBufferTest(unittest.TestCase):
...
@@ -469,12 +484,14 @@ class ChardataBufferTest(unittest.TestCase):
def
test_wrong_size
(
self
):
def
test_wrong_size
(
self
):
parser
=
expat
.
ParserCreate
()
parser
=
expat
.
ParserCreate
()
parser
.
buffer_text
=
1
parser
.
buffer_text
=
1
def
f
(
size
):
with
self
.
assertRaises
(
ValueError
):
parser
.
buffer_size
=
size
parser
.
buffer_size
=
-
1
with
self
.
assertRaises
(
ValueError
):
self
.
assertRaises
(
TypeError
,
f
,
sys
.
maxint
+
1
)
parser
.
buffer_size
=
0
self
.
assertRaises
(
ValueError
,
f
,
-
1
)
with
self
.
assertRaises
(
TypeError
):
self
.
assertRaises
(
ValueError
,
f
,
0
)
parser
.
buffer_size
=
512.0
with
self
.
assertRaises
(
TypeError
):
parser
.
buffer_size
=
sys
.
maxint
+
1
def
test_unchanged_size
(
self
):
def
test_unchanged_size
(
self
):
xml1
=
(
"<?xml version='1.0' encoding='iso8859'?><s>
%
s"
%
(
'a'
*
512
))
xml1
=
(
"<?xml version='1.0' encoding='iso8859'?><s>
%
s"
%
(
'a'
*
512
))
...
...
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