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
7582ec36
Kaydet (Commit)
7582ec36
authored
Eki 26, 2009
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
use 'is' instead of id()
üst
c04c7c5b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
test_strptime.py
Lib/test/test_strptime.py
+7
-8
No files found.
Lib/test/test_strptime.py
Dosyayı görüntüle @
7582ec36
...
@@ -493,9 +493,9 @@ class CacheTests(unittest.TestCase):
...
@@ -493,9 +493,9 @@ class CacheTests(unittest.TestCase):
_strptime
.
_strptime_time
(
"10"
,
"
%
d"
)
_strptime
.
_strptime_time
(
"10"
,
"
%
d"
)
_strptime
.
_strptime_time
(
"2005"
,
"
%
Y"
)
_strptime
.
_strptime_time
(
"2005"
,
"
%
Y"
)
_strptime
.
_TimeRE_cache
.
locale_time
.
lang
=
"Ni"
_strptime
.
_TimeRE_cache
.
locale_time
.
lang
=
"Ni"
original_time_re
=
id
(
_strptime
.
_TimeRE_cache
)
original_time_re
=
_strptime
.
_TimeRE_cache
_strptime
.
_strptime_time
(
"10"
,
"
%
d"
)
_strptime
.
_strptime_time
(
"10"
,
"
%
d"
)
self
.
assert
NotEqual
(
original_time_re
,
id
(
_strptime
.
_TimeRE_cache
)
)
self
.
assert
IsNot
(
original_time_re
,
_strptime
.
_TimeRE_cache
)
self
.
assertEqual
(
len
(
_strptime
.
_regex_cache
),
1
)
self
.
assertEqual
(
len
(
_strptime
.
_regex_cache
),
1
)
def
test_regex_cleanup
(
self
):
def
test_regex_cleanup
(
self
):
...
@@ -514,11 +514,10 @@ class CacheTests(unittest.TestCase):
...
@@ -514,11 +514,10 @@ class CacheTests(unittest.TestCase):
def
test_new_localetime
(
self
):
def
test_new_localetime
(
self
):
# A new LocaleTime instance should be created when a new TimeRE object
# A new LocaleTime instance should be created when a new TimeRE object
# is created.
# is created.
locale_time_id
=
id
(
_strptime
.
_TimeRE_cache
.
locale_time
)
locale_time_id
=
_strptime
.
_TimeRE_cache
.
locale_time
_strptime
.
_TimeRE_cache
.
locale_time
.
lang
=
"Ni"
_strptime
.
_TimeRE_cache
.
locale_time
.
lang
=
"Ni"
_strptime
.
_strptime_time
(
"10"
,
"
%
d"
)
_strptime
.
_strptime_time
(
"10"
,
"
%
d"
)
self
.
assertNotEqual
(
locale_time_id
,
self
.
assertIsNot
(
locale_time_id
,
_strptime
.
_TimeRE_cache
.
locale_time
)
id
(
_strptime
.
_TimeRE_cache
.
locale_time
))
def
test_TimeRE_recreation
(
self
):
def
test_TimeRE_recreation
(
self
):
# The TimeRE instance should be recreated upon changing the locale.
# The TimeRE instance should be recreated upon changing the locale.
...
@@ -530,15 +529,15 @@ class CacheTests(unittest.TestCase):
...
@@ -530,15 +529,15 @@ class CacheTests(unittest.TestCase):
try
:
try
:
_strptime
.
_strptime_time
(
'10'
,
'
%
d'
)
_strptime
.
_strptime_time
(
'10'
,
'
%
d'
)
# Get id of current cache object.
# Get id of current cache object.
first_time_re
_id
=
id
(
_strptime
.
_TimeRE_cache
)
first_time_re
=
_strptime
.
_TimeRE_cache
try
:
try
:
# Change the locale and force a recreation of the cache.
# Change the locale and force a recreation of the cache.
locale
.
setlocale
(
locale
.
LC_TIME
,
(
'de_DE'
,
'UTF8'
))
locale
.
setlocale
(
locale
.
LC_TIME
,
(
'de_DE'
,
'UTF8'
))
_strptime
.
_strptime_time
(
'10'
,
'
%
d'
)
_strptime
.
_strptime_time
(
'10'
,
'
%
d'
)
# Get the new cache object's id.
# Get the new cache object's id.
second_time_re
_id
=
id
(
_strptime
.
_TimeRE_cache
)
second_time_re
=
_strptime
.
_TimeRE_cache
# They should not be equal.
# They should not be equal.
self
.
assert
NotEqual
(
first_time_re_id
,
second_time_re_id
)
self
.
assert
IsNot
(
first_time_re
,
second_time_re
)
# Possible test locale is not supported while initial locale is.
# Possible test locale is not supported while initial locale is.
# If this is the case just suppress the exception and fall-through
# If this is the case just suppress the exception and fall-through
# to the reseting to the original locale.
# to the reseting to the original locale.
...
...
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