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
5ea7e310
Kaydet (Commit)
5ea7e310
authored
Eyl 30, 2004
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Improve test coverage.
üst
f751fa61
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
34 deletions
+49
-34
list_tests.py
Lib/test/list_tests.py
+0
-33
seq_tests.py
Lib/test/seq_tests.py
+35
-0
test_builtin.py
Lib/test/test_builtin.py
+3
-0
test_genexps.py
Lib/test/test_genexps.py
+0
-1
test_tuple.py
Lib/test/test_tuple.py
+11
-0
No files found.
Lib/test/list_tests.py
Dosyayı görüntüle @
5ea7e310
...
...
@@ -29,14 +29,6 @@ class CommonTest(seq_tests.CommonTest):
self
.
assertNotEqual
(
id
(
a
),
id
(
b
))
self
.
assertEqual
(
a
,
b
)
def
test_mul
(
self
):
for
m
in
xrange
(
4
):
s
=
tuple
(
range
(
m
))
for
n
in
xrange
(
-
3
,
5
):
self
.
assertEqual
(
self
.
type2test
(
s
*
n
),
self
.
type2test
(
s
)
*
n
)
self
.
assertEqual
(
self
.
type2test
(
s
)
*
(
-
4
),
self
.
type2test
([]))
self
.
assertEqual
(
id
(
s
),
id
(
s
*
1
))
def
test_repr
(
self
):
l0
=
[]
l2
=
[
0
,
1
,
2
]
...
...
@@ -70,31 +62,6 @@ class CommonTest(seq_tests.CommonTest):
fo
.
close
()
os
.
remove
(
test_support
.
TESTFN
)
def
test_getitem
(
self
):
a
=
self
.
type2test
([
10
,
11
])
self
.
assertEqual
(
a
[
0
],
10
)
self
.
assertEqual
(
a
[
1
],
11
)
self
.
assertEqual
(
a
[
-
2
],
10
)
self
.
assertEqual
(
a
[
-
1
],
11
)
self
.
assertRaises
(
IndexError
,
a
.
__getitem__
,
-
3
)
self
.
assertRaises
(
IndexError
,
a
.
__getitem__
,
3
)
def
test_subscript
(
self
):
a
=
self
.
type2test
([
10
,
11
])
self
.
assertEqual
(
a
.
__getitem__
(
0L
),
10
)
self
.
assertEqual
(
a
.
__getitem__
(
1L
),
11
)
self
.
assertEqual
(
a
.
__getitem__
(
-
2L
),
10
)
self
.
assertEqual
(
a
.
__getitem__
(
-
1L
),
11
)
self
.
assertRaises
(
IndexError
,
a
.
__getitem__
,
-
3
)
self
.
assertRaises
(
IndexError
,
a
.
__getitem__
,
3
)
self
.
assertEqual
(
a
.
__getitem__
(
slice
(
0
,
1
)),
self
.
type2test
([
10
]))
self
.
assertEqual
(
a
.
__getitem__
(
slice
(
1
,
2
)),
self
.
type2test
([
11
]))
self
.
assertEqual
(
a
.
__getitem__
(
slice
(
0
,
2
)),
self
.
type2test
([
10
,
11
]))
self
.
assertEqual
(
a
.
__getitem__
(
slice
(
0
,
3
)),
self
.
type2test
([
10
,
11
]))
self
.
assertEqual
(
a
.
__getitem__
(
slice
(
3
,
5
)),
self
.
type2test
([]))
self
.
assertRaises
(
ValueError
,
a
.
__getitem__
,
slice
(
0
,
10
,
0
))
self
.
assertRaises
(
TypeError
,
a
.
__getitem__
,
'x'
)
def
test_set_subscript
(
self
):
a
=
self
.
type2test
(
range
(
20
))
self
.
assertRaises
(
ValueError
,
a
.
__setitem__
,
slice
(
0
,
10
,
0
),
[
1
,
2
,
3
])
...
...
Lib/test/seq_tests.py
Dosyayı görüntüle @
5ea7e310
...
...
@@ -48,10 +48,13 @@ class CommonTest(unittest.TestCase):
u
=
self
.
type2test
([
0
,
1
,
2
,
3
,
4
])
for
i
in
xrange
(
len
(
u
)):
self
.
assertEqual
(
u
[
i
],
i
)
self
.
assertEqual
(
u
[
long
(
i
)],
i
)
for
i
in
xrange
(
-
len
(
u
),
-
1
):
self
.
assertEqual
(
u
[
i
],
len
(
u
)
+
i
)
self
.
assertEqual
(
u
[
long
(
i
)],
len
(
u
)
+
i
)
self
.
assertRaises
(
IndexError
,
u
.
__getitem__
,
-
len
(
u
)
-
1
)
self
.
assertRaises
(
IndexError
,
u
.
__getitem__
,
len
(
u
))
self
.
assertRaises
(
ValueError
,
u
.
__getitem__
,
slice
(
0
,
10
,
0
))
u
=
self
.
type2test
()
self
.
assertRaises
(
IndexError
,
u
.
__getitem__
,
0
)
...
...
@@ -59,6 +62,14 @@ class CommonTest(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
u
.
__getitem__
)
a
=
self
.
type2test
([
10
,
11
])
self
.
assertEqual
(
a
[
0
],
10
)
self
.
assertEqual
(
a
[
1
],
11
)
self
.
assertEqual
(
a
[
-
2
],
10
)
self
.
assertEqual
(
a
[
-
1
],
11
)
self
.
assertRaises
(
IndexError
,
a
.
__getitem__
,
-
3
)
self
.
assertRaises
(
IndexError
,
a
.
__getitem__
,
3
)
def
test_getslice
(
self
):
l
=
[
0
,
1
,
2
,
3
,
4
]
u
=
self
.
type2test
(
l
)
...
...
@@ -169,3 +180,27 @@ class CommonTest(unittest.TestCase):
def
__getitem__
(
self
,
key
):
return
str
(
key
)
+
'!!!'
self
.
assertEqual
(
iter
(
T
((
1
,
2
)))
.
next
(),
1
)
def
test_repeat
(
self
):
for
m
in
xrange
(
4
):
s
=
tuple
(
range
(
m
))
for
n
in
xrange
(
-
3
,
5
):
self
.
assertEqual
(
self
.
type2test
(
s
*
n
),
self
.
type2test
(
s
)
*
n
)
self
.
assertEqual
(
self
.
type2test
(
s
)
*
(
-
4
),
self
.
type2test
([]))
self
.
assertEqual
(
id
(
s
),
id
(
s
*
1
))
def
test_subscript
(
self
):
a
=
self
.
type2test
([
10
,
11
])
self
.
assertEqual
(
a
.
__getitem__
(
0L
),
10
)
self
.
assertEqual
(
a
.
__getitem__
(
1L
),
11
)
self
.
assertEqual
(
a
.
__getitem__
(
-
2L
),
10
)
self
.
assertEqual
(
a
.
__getitem__
(
-
1L
),
11
)
self
.
assertRaises
(
IndexError
,
a
.
__getitem__
,
-
3
)
self
.
assertRaises
(
IndexError
,
a
.
__getitem__
,
3
)
self
.
assertEqual
(
a
.
__getitem__
(
slice
(
0
,
1
)),
self
.
type2test
([
10
]))
self
.
assertEqual
(
a
.
__getitem__
(
slice
(
1
,
2
)),
self
.
type2test
([
11
]))
self
.
assertEqual
(
a
.
__getitem__
(
slice
(
0
,
2
)),
self
.
type2test
([
10
,
11
]))
self
.
assertEqual
(
a
.
__getitem__
(
slice
(
0
,
3
)),
self
.
type2test
([
10
,
11
]))
self
.
assertEqual
(
a
.
__getitem__
(
slice
(
3
,
5
)),
self
.
type2test
([]))
self
.
assertRaises
(
ValueError
,
a
.
__getitem__
,
slice
(
0
,
10
,
0
))
self
.
assertRaises
(
TypeError
,
a
.
__getitem__
,
'x'
)
Lib/test/test_builtin.py
Dosyayı görüntüle @
5ea7e310
...
...
@@ -229,6 +229,9 @@ class BuiltinTest(unittest.TestCase):
self
.
assertEqual
(
divmod
(
12L
,
-
7
),
(
-
2L
,
-
2
))
self
.
assertEqual
(
divmod
(
-
12L
,
-
7
),
(
1L
,
-
5
))
self
.
assertEqual
(
divmod
(
-
sys
.
maxint
-
1
,
-
1
),
(
sys
.
maxint
+
1
,
0
))
self
.
assert_
(
not
fcmp
(
divmod
(
3.25
,
1.0
),
(
3.0
,
0.25
)))
self
.
assert_
(
not
fcmp
(
divmod
(
-
3.25
,
1.0
),
(
-
4.0
,
0.75
)))
self
.
assert_
(
not
fcmp
(
divmod
(
3.25
,
-
1.0
),
(
-
4.0
,
-
0.75
)))
...
...
Lib/test/test_genexps.py
Dosyayı görüntüle @
5ea7e310
...
...
@@ -121,7 +121,6 @@ Verify re-use of tuples (a side benefit of using genexps over listcomps)
0
########### Tests borrowed from or inspired by test_generators.py ############
Make a generator that acts like range()
...
...
Lib/test/test_tuple.py
Dosyayı görüntüle @
5ea7e310
...
...
@@ -65,6 +65,17 @@ class TupleTest(seq_tests.CommonTest):
collisions
=
len
(
inps
)
-
len
(
set
(
map
(
hash
,
inps
)))
self
.
assert_
(
collisions
<=
15
)
def
test_repr
(
self
):
l0
=
tuple
()
l2
=
(
0
,
1
,
2
)
a0
=
self
.
type2test
(
l0
)
a2
=
self
.
type2test
(
l2
)
self
.
assertEqual
(
str
(
a0
),
repr
(
l0
))
self
.
assertEqual
(
str
(
a2
),
repr
(
l2
))
self
.
assertEqual
(
repr
(
a0
),
"()"
)
self
.
assertEqual
(
repr
(
a2
),
"(0, 1, 2)"
)
def
test_main
():
test_support
.
run_unittest
(
TupleTest
)
...
...
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