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
f389c772
Kaydet (Commit)
f389c772
authored
Şub 27, 2003
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use floor division (// and __[r]floordiv__ in right-dispatch test.
üst
f359410c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
+23
-23
test_descr.py
Lib/test/test_descr.py
+23
-23
No files found.
Lib/test/test_descr.py
Dosyayı görüntüle @
f389c772
...
...
@@ -3678,47 +3678,47 @@ def subclass_right_op():
# Case 1: subclass of int; this tests code in abstract.c::binary_op1()
class
B
(
int
):
def
__div__
(
self
,
other
):
return
"B.__div__"
def
__rdiv__
(
self
,
other
):
return
"B.__rdiv__"
def
__
floor
div__
(
self
,
other
):
return
"B.__
floor
div__"
def
__r
floor
div__
(
self
,
other
):
return
"B.__r
floor
div__"
vereq
(
B
(
1
)
/
1
,
"B.__
div__"
)
vereq
(
1
/
B
(
1
),
"B.__
rdiv__"
)
vereq
(
B
(
1
)
/
/
1
,
"B.__floor
div__"
)
vereq
(
1
/
/
B
(
1
),
"B.__rfloo
rdiv__"
)
# Case 2: subclass of object; this is just the baseline for case 3
class
C
(
object
):
def
__div__
(
self
,
other
):
return
"C.__div__"
def
__rdiv__
(
self
,
other
):
return
"C.__rdiv__"
def
__
floor
div__
(
self
,
other
):
return
"C.__
floor
div__"
def
__r
floor
div__
(
self
,
other
):
return
"C.__r
floor
div__"
vereq
(
C
()
/
1
,
"C.__
div__"
)
vereq
(
1
/
C
(),
"C.__
rdiv__"
)
vereq
(
C
()
/
/
1
,
"C.__floor
div__"
)
vereq
(
1
/
/
C
(),
"C.__rfloo
rdiv__"
)
# Case 3: subclass of new-style class; here it gets interesting
class
D
(
C
):
def
__div__
(
self
,
other
):
return
"D.__div__"
def
__rdiv__
(
self
,
other
):
return
"D.__rdiv__"
def
__
floor
div__
(
self
,
other
):
return
"D.__
floor
div__"
def
__r
floor
div__
(
self
,
other
):
return
"D.__r
floor
div__"
vereq
(
D
()
/
C
(),
"D.__
div__"
)
vereq
(
C
()
/
D
(),
"D.__
rdiv__"
)
vereq
(
D
()
/
/
C
(),
"D.__floor
div__"
)
vereq
(
C
()
/
/
D
(),
"D.__rfloo
rdiv__"
)
# Case 4: this didn't work right in 2.2.2 and 2.3a1
class
E
(
C
):
pass
vereq
(
E
.
__r
div__
,
C
.
__
rdiv__
)
vereq
(
E
.
__r
floordiv__
,
C
.
__rfloo
rdiv__
)
vereq
(
E
()
/
1
,
"C.__
div__"
)
vereq
(
1
/
E
(),
"C.__
rdiv__"
)
vereq
(
E
()
/
C
(),
"C.__
div__"
)
vereq
(
C
()
/
E
(),
"C.__
div__"
)
# This one would fail
vereq
(
E
()
/
/
1
,
"C.__floor
div__"
)
vereq
(
1
/
/
E
(),
"C.__rfloo
rdiv__"
)
vereq
(
E
()
/
/
C
(),
"C.__floor
div__"
)
vereq
(
C
()
/
/
E
(),
"C.__floor
div__"
)
# This one would fail
def
dict_type_with_metaclass
():
if
verbose
:
...
...
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