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
1bf71172
Kaydet (Commit)
1bf71172
authored
Mar 08, 2002
tarafından
Andrew M. Kuchling
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
As part of fixing bug #523301, add a simple test of ConfigParser.write()
üst
00824ed7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
test_cfgparser
Lib/test/output/test_cfgparser
+1
-0
test_cfgparser.py
Lib/test/test_cfgparser.py
+29
-0
No files found.
Lib/test/output/test_cfgparser
Dosyayı görüntüle @
1bf71172
test_cfgparser
test_cfgparser
Testing basic accessors...
Testing basic accessors...
Testing writing of files...
Testing case sensitivity...
Testing case sensitivity...
Testing interpretation of boolean Values...
Testing interpretation of boolean Values...
Testing value interpolation...
Testing value interpolation...
...
...
Lib/test/test_cfgparser.py
Dosyayı görüntüle @
1bf71172
...
@@ -14,6 +14,7 @@ def basic(src):
...
@@ -14,6 +14,7 @@ def basic(src):
verify
(
L
==
[
r'Commented Bar'
,
verify
(
L
==
[
r'Commented Bar'
,
r'Foo Bar'
,
r'Foo Bar'
,
r'Internationalized Stuff'
,
r'Internationalized Stuff'
,
r'Long Line'
,
r'Section\with$weird
%
characters['
'
\t
'
,
r'Section\with$weird
%
characters['
'
\t
'
,
r'Spacey Bar'
,
r'Spacey Bar'
,
],
],
...
@@ -47,7 +48,26 @@ def basic(src):
...
@@ -47,7 +48,26 @@ def basic(src):
"remove_option() failed to report non-existance of option"
"remove_option() failed to report non-existance of option"
" that never existed"
)
" that never existed"
)
verify
(
cf
.
get
(
'Long Line'
,
'foo'
,
raw
=
1
)
==
'this line is much, much longer than my editor
\n
likes it.'
)
def
write
(
src
):
print
"Testing writing of files..."
cf
=
ConfigParser
.
ConfigParser
()
sio
=
StringIO
.
StringIO
(
src
)
cf
.
readfp
(
sio
)
output
=
StringIO
.
StringIO
()
cf
.
write
(
output
)
verify
(
output
,
"""[DEFAULT]
foo = another very
long line
[Long Line]
foo = this line is much, much longer than my editor
likes it.
"""
)
def
case_sensitivity
():
def
case_sensitivity
():
print
"Testing case sensitivity..."
print
"Testing case sensitivity..."
cf
=
ConfigParser
.
ConfigParser
()
cf
=
ConfigParser
.
ConfigParser
()
...
@@ -191,6 +211,9 @@ foo=bar
...
@@ -191,6 +211,9 @@ foo=bar
foo = bar
foo = bar
[Commented Bar]
[Commented Bar]
foo: bar ; comment
foo: bar ; comment
[Long Line]
foo: this line is much, much longer than my editor
likes it.
[Section\with$weird
%
characters["""
'
\t
'
r"""]
[Section\with$weird
%
characters["""
'
\t
'
r"""]
[Internationalized Stuff]
[Internationalized Stuff]
foo[bg]: Bulgarian
foo[bg]: Bulgarian
...
@@ -198,6 +221,12 @@ foo=Default
...
@@ -198,6 +221,12 @@ foo=Default
foo[en]=English
foo[en]=English
foo[de]=Deutsch
foo[de]=Deutsch
"""
)
"""
)
write
(
"""[Long Line]
foo: this line is much, much longer than my editor
likes it.
[DEFAULT]
foo: another very
long line"""
)
case_sensitivity
()
case_sensitivity
()
boolean
(
r"""
boolean
(
r"""
[BOOLTEST]
[BOOLTEST]
...
...
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