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
a29159b0
Kaydet (Commit)
a29159b0
authored
Ara 27, 2012
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #16793. Replace deprecated unittest asserts with modern counterparts.
üst
1ef73d21
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
test_fromlist.py
Lib/test/test_importlib/import_/test_fromlist.py
+1
-1
test_int.py
Lib/test/test_int.py
+10
-10
No files found.
Lib/test/test_importlib/import_/test_fromlist.py
Dosyayı görüntüle @
a29159b0
...
...
@@ -80,7 +80,7 @@ class HandlingFromlist(unittest.TestCase):
with
util
.
import_state
(
meta_path
=
[
importer
]):
with
self
.
assertRaises
(
ImportError
)
as
exc
:
import_util
.
import_
(
'pkg'
,
fromlist
=
[
'mod'
])
self
.
assertEqual
s
(
'i_do_not_exist'
,
exc
.
exception
.
name
)
self
.
assertEqual
(
'i_do_not_exist'
,
exc
.
exception
.
name
)
def
test_empty_string
(
self
):
with
util
.
mock_modules
(
'pkg.__init__'
,
'pkg.mod'
)
as
importer
:
...
...
Lib/test/test_int.py
Dosyayı görüntüle @
a29159b0
...
...
@@ -226,23 +226,23 @@ class IntTestCases(unittest.TestCase):
self
.
assertIs
(
int
(
b
'-1'
),
-
1
)
def
test_no_args
(
self
):
self
.
assertEqual
s
(
int
(),
0
)
self
.
assertEqual
(
int
(),
0
)
def
test_keyword_args
(
self
):
# Test invoking int() using keyword arguments.
self
.
assertEqual
s
(
int
(
x
=
1.2
),
1
)
self
.
assertEqual
s
(
int
(
'100'
,
base
=
2
),
4
)
self
.
assertEqual
s
(
int
(
x
=
'100'
,
base
=
2
),
4
)
self
.
assertEqual
(
int
(
x
=
1.2
),
1
)
self
.
assertEqual
(
int
(
'100'
,
base
=
2
),
4
)
self
.
assertEqual
(
int
(
x
=
'100'
,
base
=
2
),
4
)
# For example, PyPy 1.9.0 raised TypeError for these cases because it
# expects x to be a string if base is given.
@support.cpython_only
def
test_base_arg_with_no_x_arg
(
self
):
self
.
assertEqual
s
(
int
(
base
=
6
),
0
)
self
.
assertEqual
(
int
(
base
=
6
),
0
)
# Even invalid bases don't raise an exception.
self
.
assertEqual
s
(
int
(
base
=
1
),
0
)
self
.
assertEqual
s
(
int
(
base
=
1000
),
0
)
self
.
assertEqual
s
(
int
(
base
=
'foo'
),
0
)
self
.
assertEqual
(
int
(
base
=
1
),
0
)
self
.
assertEqual
(
int
(
base
=
1000
),
0
)
self
.
assertEqual
(
int
(
base
=
'foo'
),
0
)
def
test_non_numeric_input_types
(
self
):
# Test possible non-numeric types for the argument x, including
...
...
@@ -259,8 +259,8 @@ class IntTestCases(unittest.TestCase):
for
x
in
values
:
msg
=
'x has type
%
s'
%
type
(
x
)
.
__name__
self
.
assertEqual
s
(
int
(
x
),
100
,
msg
=
msg
)
self
.
assertEqual
s
(
int
(
x
,
2
),
4
,
msg
=
msg
)
self
.
assertEqual
(
int
(
x
),
100
,
msg
=
msg
)
self
.
assertEqual
(
int
(
x
,
2
),
4
,
msg
=
msg
)
def
test_string_float
(
self
):
self
.
assertRaises
(
ValueError
,
int
,
'1.2'
)
...
...
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