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
e601fb06
Kaydet (Commit)
e601fb06
authored
Şub 27, 2013
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#17304: test_hash now works with unittest test discovery. Patch by Zachary Ware.
üst
1ed6be37
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
21 deletions
+14
-21
test_hash.py
Lib/test/test_hash.py
+11
-21
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_hash.py
Dosyayı görüntüle @
e601fb06
...
@@ -7,7 +7,6 @@ import datetime
...
@@ -7,7 +7,6 @@ import datetime
import
os
import
os
import
sys
import
sys
import
unittest
import
unittest
from
test
import
support
from
test.script_helper
import
assert_python_ok
from
test.script_helper
import
assert_python_ok
from
collections
import
Hashable
from
collections
import
Hashable
...
@@ -133,7 +132,7 @@ class HashBuiltinsTestCase(unittest.TestCase):
...
@@ -133,7 +132,7 @@ class HashBuiltinsTestCase(unittest.TestCase):
for
obj
in
self
.
hashes_to_check
:
for
obj
in
self
.
hashes_to_check
:
self
.
assertEqual
(
hash
(
obj
),
_default_hash
(
obj
))
self
.
assertEqual
(
hash
(
obj
),
_default_hash
(
obj
))
class
HashRandomizationTests
(
unittest
.
TestCase
)
:
class
HashRandomizationTests
:
# Each subclass should define a field "repr_", containing the repr() of
# Each subclass should define a field "repr_", containing the repr() of
# an object to be tested
# an object to be tested
...
@@ -190,19 +189,22 @@ class StringlikeHashRandomizationTests(HashRandomizationTests):
...
@@ -190,19 +189,22 @@ class StringlikeHashRandomizationTests(HashRandomizationTests):
h
=
-
1024014457
h
=
-
1024014457
self
.
assertEqual
(
self
.
get_hash
(
self
.
repr_
,
seed
=
42
),
h
)
self
.
assertEqual
(
self
.
get_hash
(
self
.
repr_
,
seed
=
42
),
h
)
class
StrHashRandomizationTests
(
StringlikeHashRandomizationTests
):
class
StrHashRandomizationTests
(
StringlikeHashRandomizationTests
,
unittest
.
TestCase
):
repr_
=
repr
(
'abc'
)
repr_
=
repr
(
'abc'
)
def
test_empty_string
(
self
):
def
test_empty_string
(
self
):
self
.
assertEqual
(
hash
(
""
),
0
)
self
.
assertEqual
(
hash
(
""
),
0
)
class
BytesHashRandomizationTests
(
StringlikeHashRandomizationTests
):
class
BytesHashRandomizationTests
(
StringlikeHashRandomizationTests
,
unittest
.
TestCase
):
repr_
=
repr
(
b
'abc'
)
repr_
=
repr
(
b
'abc'
)
def
test_empty_string
(
self
):
def
test_empty_string
(
self
):
self
.
assertEqual
(
hash
(
b
""
),
0
)
self
.
assertEqual
(
hash
(
b
""
),
0
)
class
MemoryviewHashRandomizationTests
(
StringlikeHashRandomizationTests
):
class
MemoryviewHashRandomizationTests
(
StringlikeHashRandomizationTests
,
unittest
.
TestCase
):
repr_
=
"memoryview(b'abc')"
repr_
=
"memoryview(b'abc')"
def
test_empty_string
(
self
):
def
test_empty_string
(
self
):
...
@@ -212,27 +214,15 @@ class DatetimeTests(HashRandomizationTests):
...
@@ -212,27 +214,15 @@ class DatetimeTests(HashRandomizationTests):
def
get_hash_command
(
self
,
repr_
):
def
get_hash_command
(
self
,
repr_
):
return
'import datetime; print(hash(
%
s))'
%
repr_
return
'import datetime; print(hash(
%
s))'
%
repr_
class
DatetimeDateTests
(
DatetimeTests
):
class
DatetimeDateTests
(
DatetimeTests
,
unittest
.
TestCase
):
repr_
=
repr
(
datetime
.
date
(
1066
,
10
,
14
))
repr_
=
repr
(
datetime
.
date
(
1066
,
10
,
14
))
class
DatetimeDatetimeTests
(
DatetimeTests
):
class
DatetimeDatetimeTests
(
DatetimeTests
,
unittest
.
TestCase
):
repr_
=
repr
(
datetime
.
datetime
(
1
,
2
,
3
,
4
,
5
,
6
,
7
))
repr_
=
repr
(
datetime
.
datetime
(
1
,
2
,
3
,
4
,
5
,
6
,
7
))
class
DatetimeTimeTests
(
DatetimeTests
):
class
DatetimeTimeTests
(
DatetimeTests
,
unittest
.
TestCase
):
repr_
=
repr
(
datetime
.
time
(
0
))
repr_
=
repr
(
datetime
.
time
(
0
))
def
test_main
():
support
.
run_unittest
(
HashEqualityTestCase
,
HashInheritanceTestCase
,
HashBuiltinsTestCase
,
StrHashRandomizationTests
,
BytesHashRandomizationTests
,
MemoryviewHashRandomizationTests
,
DatetimeDateTests
,
DatetimeDatetimeTests
,
DatetimeTimeTests
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
test_
main
()
unittest
.
main
()
Misc/NEWS
Dosyayı görüntüle @
e601fb06
...
@@ -644,6 +644,9 @@ Tests
...
@@ -644,6 +644,9 @@ Tests
- Issue #15539: Added regression tests for Tools/scripts/pindent.py.
- Issue #15539: Added regression tests for Tools/scripts/pindent.py.
- Issue #17304: test_hash now works with unittest test discovery.
Patch by Zachary Ware.
- Issue #17303: test_future* now work with unittest test discovery.
- Issue #17303: test_future* now work with unittest test discovery.
Patch by Zachary Ware.
Patch by Zachary Ware.
...
...
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