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
b7a7731e
Kaydet (Commit)
b7a7731e
authored
Tem 30, 2001
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add tests for getattr() and hasattr() with non-string args
üst
302b54ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
test_b1.py
Lib/test/test_b1.py
+18
-0
test_b2.py
Lib/test/test_b2.py
+6
-0
No files found.
Lib/test/test_b1.py
Dosyayı görüntüle @
b7a7731e
...
@@ -256,10 +256,28 @@ if float(u" \u0663.\u0661\u0664 ") != 3.14:
...
@@ -256,10 +256,28 @@ if float(u" \u0663.\u0661\u0664 ") != 3.14:
print
'getattr'
print
'getattr'
import
sys
import
sys
if
getattr
(
sys
,
'stdout'
)
is
not
sys
.
stdout
:
raise
TestFailed
,
'getattr'
if
getattr
(
sys
,
'stdout'
)
is
not
sys
.
stdout
:
raise
TestFailed
,
'getattr'
try
:
getattr
(
sys
,
1
)
except
TypeError
:
pass
else
:
raise
TestFailed
,
"getattr(sys, 1) should raise an exception"
try
:
getattr
(
sys
,
1
,
"foo"
)
except
TypeError
:
pass
else
:
raise
TestFailed
,
'getattr(sys, 1, "foo") should raise an exception'
print
'hasattr'
print
'hasattr'
import
sys
import
sys
if
not
hasattr
(
sys
,
'stdout'
):
raise
TestFailed
,
'hasattr'
if
not
hasattr
(
sys
,
'stdout'
):
raise
TestFailed
,
'hasattr'
try
:
hasattr
(
sys
,
1
)
except
TypeError
:
pass
else
:
raise
TestFailed
,
"hasattr(sys, 1) should raise an exception"
print
'hash'
print
'hash'
hash
(
None
)
hash
(
None
)
...
...
Lib/test/test_b2.py
Dosyayı görüntüle @
b7a7731e
...
@@ -205,6 +205,12 @@ print 'setattr'
...
@@ -205,6 +205,12 @@ print 'setattr'
import
sys
import
sys
setattr
(
sys
,
'spam'
,
1
)
setattr
(
sys
,
'spam'
,
1
)
if
sys
.
spam
!=
1
:
raise
TestFailed
,
'setattr(sys,
\'
spam
\'
, 1)'
if
sys
.
spam
!=
1
:
raise
TestFailed
,
'setattr(sys,
\'
spam
\'
, 1)'
try
:
setattr
(
sys
,
1
,
'spam'
)
except
TypeError
:
pass
else
:
raise
TestFailed
,
"setattr(sys, 1, 'spam') should raise exception"
print
'str'
print
'str'
if
str
(
''
)
!=
''
:
raise
TestFailed
,
'str(
\'\'
)'
if
str
(
''
)
!=
''
:
raise
TestFailed
,
'str(
\'\'
)'
...
...
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