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
a146bef0
Kaydet (Commit)
a146bef0
authored
Şub 06, 2014
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Catch deprecation warnings emitted when non-integers are formatted with %c, %o
and %x (introduced in issue #19995).
üst
303718c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
string_tests.py
Lib/test/string_tests.py
+2
-1
test_format.py
Lib/test/test_format.py
+10
-5
No files found.
Lib/test/string_tests.py
Dosyayı görüntüle @
a146bef0
...
...
@@ -1179,7 +1179,8 @@ class MixinStrUnicodeUserStringTest:
self
.
checkraises
(
TypeError
,
'abc'
,
'__mod__'
)
self
.
checkraises
(
TypeError
,
'
%(foo)
s'
,
'__mod__'
,
42
)
self
.
checkraises
(
TypeError
,
'
%
s
%
s'
,
'__mod__'
,
(
42
,))
self
.
checkraises
(
TypeError
,
'
%
c'
,
'__mod__'
,
(
None
,))
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
checkraises
(
TypeError
,
'
%
c'
,
'__mod__'
,
(
None
,))
self
.
checkraises
(
ValueError
,
'
%
(foo'
,
'__mod__'
,
{})
self
.
checkraises
(
TypeError
,
'
%(foo)
s
%(bar)
s'
,
'__mod__'
,
(
'foo'
,
42
))
self
.
checkraises
(
TypeError
,
'
%
d'
,
'__mod__'
,
"42"
)
# not numeric
...
...
Lib/test/test_format.py
Dosyayı görüntüle @
a146bef0
...
...
@@ -142,7 +142,8 @@ class FormatTest(unittest.TestCase):
testformat
(
"
%#+027.23
X"
,
big
,
"+0X0001234567890ABCDEF12345"
)
# same, except no 0 flag
testformat
(
"
%#+27.23
X"
,
big
,
" +0X001234567890ABCDEF12345"
)
testformat
(
"
%
x"
,
float
(
big
),
"123456_______________"
,
6
)
with
self
.
assertWarns
(
DeprecationWarning
):
testformat
(
"
%
x"
,
float
(
big
),
"123456_______________"
,
6
)
big
=
0
o12345670123456701234567012345670
# 32 octal digits
testformat
(
"
%
o"
,
big
,
"12345670123456701234567012345670"
)
testformat
(
"
%
o"
,
-
big
,
"-12345670123456701234567012345670"
)
...
...
@@ -182,7 +183,8 @@ class FormatTest(unittest.TestCase):
testformat
(
"
%034.33
o"
,
big
,
"0012345670123456701234567012345670"
)
# base marker shouldn't change that
testformat
(
"
%0#34.33
o"
,
big
,
"0o012345670123456701234567012345670"
)
testformat
(
"
%
o"
,
float
(
big
),
"123456__________________________"
,
6
)
with
self
.
assertWarns
(
DeprecationWarning
):
testformat
(
"
%
o"
,
float
(
big
),
"123456__________________________"
,
6
)
# Some small ints, in both Python int and flavors).
testformat
(
"
%
d"
,
42
,
"42"
)
testformat
(
"
%
d"
,
-
42
,
"-42"
)
...
...
@@ -193,7 +195,8 @@ class FormatTest(unittest.TestCase):
testformat
(
"
%#
x"
,
1
,
"0x1"
)
testformat
(
"
%#
X"
,
1
,
"0X1"
)
testformat
(
"
%#
X"
,
1
,
"0X1"
)
testformat
(
"
%#
x"
,
1.0
,
"0x1"
)
with
self
.
assertWarns
(
DeprecationWarning
):
testformat
(
"
%#
x"
,
1.0
,
"0x1"
)
testformat
(
"
%#
o"
,
1
,
"0o1"
)
testformat
(
"
%#
o"
,
1
,
"0o1"
)
testformat
(
"
%#
o"
,
0
,
"0o0"
)
...
...
@@ -210,12 +213,14 @@ class FormatTest(unittest.TestCase):
testformat
(
"
%
x"
,
-
0x42
,
"-42"
)
testformat
(
"
%
x"
,
0x42
,
"42"
)
testformat
(
"
%
x"
,
-
0x42
,
"-42"
)
testformat
(
"
%
x"
,
float
(
0x42
),
"42"
)
with
self
.
assertWarns
(
DeprecationWarning
):
testformat
(
"
%
x"
,
float
(
0x42
),
"42"
)
testformat
(
"
%
o"
,
0
o42
,
"42"
)
testformat
(
"
%
o"
,
-
0
o42
,
"-42"
)
testformat
(
"
%
o"
,
0
o42
,
"42"
)
testformat
(
"
%
o"
,
-
0
o42
,
"-42"
)
testformat
(
"
%
o"
,
float
(
0
o42
),
"42"
)
with
self
.
assertWarns
(
DeprecationWarning
):
testformat
(
"
%
o"
,
float
(
0
o42
),
"42"
)
testformat
(
"
%
r"
,
"
\u0378
"
,
"'
\\
u0378'"
)
# non printable
testformat
(
"
%
a"
,
"
\u0378
"
,
"'
\\
u0378'"
)
# non printable
testformat
(
"
%
r"
,
"
\u0374
"
,
"'
\u0374
'"
)
# printable
...
...
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