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
302bd589
Kaydet (Commit)
302bd589
authored
Eyl 13, 2004
tarafından
Barry Warsaw
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add tests for keyword arguments and combining mapping and keyword arguments.
üst
46b629c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
test_pep292.py
Lib/test/test_pep292.py
+28
-0
No files found.
Lib/test/test_pep292.py
Dosyayı görüntüle @
302bd589
...
...
@@ -118,6 +118,34 @@ class TestTemplate(unittest.TestCase):
d
=
dict
(
who
=
u't
\xff
m'
,
what
=
u'f
\xfe\f
ed'
)
self
.
assertEqual
(
s
.
substitute
(
d
),
u't
\xff
m likes f
\xfe\x0c
ed'
)
def
test_keyword_arguments
(
self
):
eq
=
self
.
assertEqual
s
=
Template
(
'$who likes $what'
)
eq
(
s
.
substitute
(
who
=
'tim'
,
what
=
'ham'
),
'tim likes ham'
)
eq
(
s
.
substitute
(
dict
(
who
=
'tim'
),
what
=
'ham'
),
'tim likes ham'
)
eq
(
s
.
substitute
(
dict
(
who
=
'fred'
,
what
=
'kung pao'
),
who
=
'tim'
,
what
=
'ham'
),
'tim likes ham'
)
s
=
Template
(
'the mapping is $mapping'
)
eq
(
s
.
substitute
(
dict
(
foo
=
'none'
),
mapping
=
'bozo'
),
'the mapping is bozo'
)
eq
(
s
.
substitute
(
dict
(
mapping
=
'one'
),
mapping
=
'two'
),
'the mapping is two'
)
def
test_keyword_arguments_safe
(
self
):
eq
=
self
.
assertEqual
s
=
Template
(
'$who likes $what'
)
eq
(
s
.
safe_substitute
(
who
=
'tim'
,
what
=
'ham'
),
'tim likes ham'
)
eq
(
s
.
safe_substitute
(
dict
(
who
=
'tim'
),
what
=
'ham'
),
'tim likes ham'
)
eq
(
s
.
safe_substitute
(
dict
(
who
=
'fred'
,
what
=
'kung pao'
),
who
=
'tim'
,
what
=
'ham'
),
'tim likes ham'
)
s
=
Template
(
'the mapping is $mapping'
)
eq
(
s
.
safe_substitute
(
dict
(
foo
=
'none'
),
mapping
=
'bozo'
),
'the mapping is bozo'
)
eq
(
s
.
safe_substitute
(
dict
(
mapping
=
'one'
),
mapping
=
'two'
),
'the mapping is two'
)
def
suite
():
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