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
7ff55e6b
Kaydet (Commit)
7ff55e6b
authored
Haz 27, 2003
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add tests for __nonzero__() problems.
üst
3e3159ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
test_bool.py
Lib/test/test_bool.py
+21
-0
No files found.
Lib/test/test_bool.py
Dosyayı görüntüle @
7ff55e6b
...
...
@@ -320,6 +320,27 @@ class BoolTest(unittest.TestCase):
self
.
assertEqual
(
cPickle
.
dumps
(
True
,
True
),
"I01
\n
."
)
self
.
assertEqual
(
cPickle
.
dumps
(
False
,
True
),
"I00
\n
."
)
def
test_convert_to_bool
(
self
):
# Verify that TypeError occurs when bad things are returned
# from __nonzero__(). This isn't really a bool test, but
# it's related.
check
=
lambda
o
:
self
.
assertRaises
(
TypeError
,
bool
,
o
)
class
Foo
(
object
):
def
__nonzero__
(
self
):
return
self
check
(
Foo
())
class
Bar
(
object
):
def
__nonzero__
(
self
):
return
"Yes"
check
(
Bar
())
class
Baz
(
int
):
def
__nonzero__
(
self
):
return
self
check
(
Baz
())
def
test_main
():
test_support
.
run_unittest
(
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