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
98e3b29b
Kaydet (Commit)
98e3b29b
authored
Eki 25, 2002
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add tests for both raw and non-raw versions of the items() methods.
üst
df393bd4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
test_cfgparser.py
Lib/test/test_cfgparser.py
+26
-0
No files found.
Lib/test/test_cfgparser.py
Dosyayı görüntüle @
98e3b29b
...
@@ -230,6 +230,18 @@ class TestCaseBase(unittest.TestCase):
...
@@ -230,6 +230,18 @@ class TestCaseBase(unittest.TestCase):
"bar=
%(foo)
s
\n
"
,
"bar=
%(foo)
s
\n
"
,
defaults
=
{
"getname"
:
"
%(__name__)
s"
})
defaults
=
{
"getname"
:
"
%(__name__)
s"
})
def
check_items_config
(
self
,
expected
):
cf
=
self
.
fromstring
(
"[section]
\n
"
"name = value
\n
"
"key: |
%(name)
s|
\n
"
"getdefault: |
%(default)
s|
\n
"
"getname: |
%(__name__)
s|"
,
defaults
=
{
"default"
:
"<default>"
})
L
=
list
(
cf
.
items
(
"section"
))
L
.
sort
()
self
.
assertEqual
(
L
,
expected
)
class
ConfigParserTestCase
(
TestCaseBase
):
class
ConfigParserTestCase
(
TestCaseBase
):
config_class
=
ConfigParser
.
ConfigParser
config_class
=
ConfigParser
.
ConfigParser
...
@@ -245,6 +257,13 @@ class ConfigParserTestCase(TestCaseBase):
...
@@ -245,6 +257,13 @@ class ConfigParserTestCase(TestCaseBase):
"something with lots of interpolation (10 steps)"
)
"something with lots of interpolation (10 steps)"
)
self
.
get_error
(
ConfigParser
.
InterpolationDepthError
,
"Foo"
,
"bar11"
)
self
.
get_error
(
ConfigParser
.
InterpolationDepthError
,
"Foo"
,
"bar11"
)
def
test_items
(
self
):
self
.
check_items_config
([(
'default'
,
'<default>'
),
(
'getdefault'
,
'|<default>|'
),
(
'getname'
,
'|section|'
),
(
'key'
,
'|value|'
),
(
'name'
,
'value'
)])
class
RawConfigParserTestCase
(
TestCaseBase
):
class
RawConfigParserTestCase
(
TestCaseBase
):
config_class
=
ConfigParser
.
RawConfigParser
config_class
=
ConfigParser
.
RawConfigParser
...
@@ -262,6 +281,13 @@ class RawConfigParserTestCase(TestCaseBase):
...
@@ -262,6 +281,13 @@ class RawConfigParserTestCase(TestCaseBase):
eq
(
cf
.
get
(
"Foo"
,
"bar11"
),
eq
(
cf
.
get
(
"Foo"
,
"bar11"
),
"something
%(with11)
s lots of interpolation (11 steps)"
)
"something
%(with11)
s lots of interpolation (11 steps)"
)
def
test_items
(
self
):
self
.
check_items_config
([(
'default'
,
'<default>'
),
(
'getdefault'
,
'|
%(default)
s|'
),
(
'getname'
,
'|
%(__name__)
s|'
),
(
'key'
,
'|
%(name)
s|'
),
(
'name'
,
'value'
)])
def
test_main
():
def
test_main
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
...
...
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