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
cf2ce36f
Kaydet (Commit)
cf2ce36f
authored
Agu 24, 2007
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Keir Mierle's improved tests for dict view containment tests.
üst
1d719960
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
35 deletions
+37
-35
test_dict.py
Lib/test/test_dict.py
+37
-35
No files found.
Lib/test/test_dict.py
Dosyayı görüntüle @
cf2ce36f
...
...
@@ -399,50 +399,52 @@ class DictTest(unittest.TestCase):
self
.
fail
(
"< didn't raise Exc"
)
def
test_keys_contained
(
self
):
self
.
helper_keys_contained
(
lambda
x
:
x
.
keys
())
self
.
helper_keys_contained
(
lambda
x
:
x
.
items
())
def
helper_keys_contained
(
self
,
fn
):
# Test rich comparisons against dict key views, which should behave the
# same as sets.
empty
=
dict
(
)
empty2
=
dict
(
)
smaller
=
{
1
:
1
,
2
:
2
}
larger
=
{
1
:
1
,
2
:
2
,
3
:
3
}
larger2
=
{
1
:
1
,
2
:
2
,
3
:
3
}
larger3
=
{
4
:
1
,
2
:
2
,
3
:
3
}
self
.
assertTrue
(
smaller
.
keys
()
<
larger
.
keys
()
)
self
.
assertTrue
(
smaller
.
keys
()
<=
larger
.
keys
()
)
self
.
assertTrue
(
larger
.
keys
()
>
smaller
.
keys
()
)
self
.
assertTrue
(
larger
.
keys
()
>=
smaller
.
keys
()
)
self
.
assertFalse
(
smaller
.
keys
()
>=
larger
.
keys
()
)
self
.
assertFalse
(
smaller
.
keys
()
>
larger
.
keys
()
)
self
.
assertFalse
(
larger
.
keys
()
<=
smaller
.
keys
()
)
self
.
assertFalse
(
larger
.
keys
()
<
smaller
.
keys
()
)
self
.
assertFalse
(
smaller
.
keys
()
<
larger3
.
keys
()
)
self
.
assertFalse
(
smaller
.
keys
()
<=
larger3
.
keys
()
)
self
.
assertFalse
(
larger3
.
keys
()
>
smaller
.
keys
()
)
self
.
assertFalse
(
larger3
.
keys
()
>=
smaller
.
keys
()
)
empty
=
fn
(
dict
()
)
empty2
=
fn
(
dict
()
)
smaller
=
fn
({
1
:
1
,
2
:
2
})
larger
=
fn
({
1
:
1
,
2
:
2
,
3
:
3
})
larger2
=
fn
({
1
:
1
,
2
:
2
,
3
:
3
})
larger3
=
fn
({
4
:
1
,
2
:
2
,
3
:
3
})
self
.
assertTrue
(
smaller
<
larger
)
self
.
assertTrue
(
smaller
<=
larger
)
self
.
assertTrue
(
larger
>
smaller
)
self
.
assertTrue
(
larger
>=
smaller
)
self
.
assertFalse
(
smaller
>=
larger
)
self
.
assertFalse
(
smaller
>
larger
)
self
.
assertFalse
(
larger
<=
smaller
)
self
.
assertFalse
(
larger
<
smaller
)
self
.
assertFalse
(
smaller
<
larger3
)
self
.
assertFalse
(
smaller
<=
larger3
)
self
.
assertFalse
(
larger3
>
smaller
)
self
.
assertFalse
(
larger3
>=
smaller
)
# Inequality strictness
self
.
assertTrue
(
larger2
.
keys
()
>=
larger
.
keys
()
)
self
.
assertTrue
(
larger2
.
keys
()
<=
larger
.
keys
()
)
self
.
assertFalse
(
larger2
.
keys
()
>
larger
.
keys
()
)
self
.
assertFalse
(
larger2
.
keys
()
<
larger
.
keys
()
)
self
.
assertTrue
(
larger2
>=
larger
)
self
.
assertTrue
(
larger2
<=
larger
)
self
.
assertFalse
(
larger2
>
larger
)
self
.
assertFalse
(
larger2
<
larger
)
self
.
assertTrue
(
larger
.
keys
()
==
larger2
.
keys
()
)
self
.
assertTrue
(
smaller
.
keys
()
!=
larger
.
keys
()
)
self
.
assertTrue
(
larger
==
larger2
)
self
.
assertTrue
(
smaller
!=
larger
)
# There is an optimization on the zero-element case.
self
.
assertTrue
(
empty
.
keys
()
==
empty2
.
keys
()
)
self
.
assertFalse
(
empty
.
keys
()
!=
empty2
.
keys
()
)
self
.
assertFalse
(
empty
.
keys
()
==
smaller
.
keys
()
)
self
.
assertTrue
(
empty
.
keys
()
!=
smaller
.
keys
()
)
self
.
assertTrue
(
empty
==
empty2
)
self
.
assertFalse
(
empty
!=
empty2
)
self
.
assertFalse
(
empty
==
smaller
)
self
.
assertTrue
(
empty
!=
smaller
)
# With the same size, an elementwise compare happens
self
.
assertTrue
(
larger
.
keys
()
!=
larger3
.
keys
())
self
.
assertFalse
(
larger
.
keys
()
==
larger3
.
keys
())
# XXX the same tests for .items()
self
.
assertTrue
(
larger
!=
larger3
)
self
.
assertFalse
(
larger
==
larger3
)
def
test_errors_in_view_containment_check
(
self
):
class
C
:
...
...
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