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
b9a40aca
Kaydet (Commit)
b9a40aca
authored
Kas 10, 2017
tarafından
Miss Islington (bot)
Kaydeden (comit)
Victor Stinner
Kas 10, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-31222: Make (datetime|date|time).replace return subclass type in Pure Python (GH-4176) (#4356)
(cherry picked from commit
191e9933
)
üst
596286f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
datetime.py
Lib/datetime.py
+3
-3
datetimetester.py
Lib/test/datetimetester.py
+14
-0
No files found.
Lib/datetime.py
Dosyayı görüntüle @
b9a40aca
...
@@ -827,7 +827,7 @@ class date:
...
@@ -827,7 +827,7 @@ class date:
month
=
self
.
_month
month
=
self
.
_month
if
day
is
None
:
if
day
is
None
:
day
=
self
.
_day
day
=
self
.
_day
return
date
(
year
,
month
,
day
)
return
type
(
self
)
(
year
,
month
,
day
)
# Comparisons of date objects with other.
# Comparisons of date objects with other.
...
@@ -1315,7 +1315,7 @@ class time:
...
@@ -1315,7 +1315,7 @@ class time:
tzinfo
=
self
.
tzinfo
tzinfo
=
self
.
tzinfo
if
fold
is
None
:
if
fold
is
None
:
fold
=
self
.
_fold
fold
=
self
.
_fold
return
t
ime
(
hour
,
minute
,
second
,
microsecond
,
tzinfo
,
fold
=
fold
)
return
t
ype
(
self
)
(
hour
,
minute
,
second
,
microsecond
,
tzinfo
,
fold
=
fold
)
# Pickle support.
# Pickle support.
...
@@ -1596,7 +1596,7 @@ class datetime(date):
...
@@ -1596,7 +1596,7 @@ class datetime(date):
tzinfo
=
self
.
tzinfo
tzinfo
=
self
.
tzinfo
if
fold
is
None
:
if
fold
is
None
:
fold
=
self
.
fold
fold
=
self
.
fold
return
datetime
(
year
,
month
,
day
,
hour
,
minute
,
second
,
return
type
(
self
)
(
year
,
month
,
day
,
hour
,
minute
,
second
,
microsecond
,
tzinfo
,
fold
=
fold
)
microsecond
,
tzinfo
,
fold
=
fold
)
def
_local_timezone
(
self
):
def
_local_timezone
(
self
):
...
...
Lib/test/datetimetester.py
Dosyayı görüntüle @
b9a40aca
...
@@ -1500,6 +1500,13 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase):
...
@@ -1500,6 +1500,13 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase):
base
=
cls
(
2000
,
2
,
29
)
base
=
cls
(
2000
,
2
,
29
)
self
.
assertRaises
(
ValueError
,
base
.
replace
,
year
=
2001
)
self
.
assertRaises
(
ValueError
,
base
.
replace
,
year
=
2001
)
def
test_subclass_replace
(
self
):
class
DateSubclass
(
self
.
theclass
):
pass
dt
=
DateSubclass
(
2012
,
1
,
1
)
self
.
assertIs
(
type
(
dt
.
replace
(
year
=
2013
)),
DateSubclass
)
def
test_subclass_date
(
self
):
def
test_subclass_date
(
self
):
class
C
(
self
.
theclass
):
class
C
(
self
.
theclass
):
...
@@ -2599,6 +2606,13 @@ class TestTime(HarmlessMixedComparison, unittest.TestCase):
...
@@ -2599,6 +2606,13 @@ class TestTime(HarmlessMixedComparison, unittest.TestCase):
self
.
assertRaises
(
ValueError
,
base
.
replace
,
second
=
100
)
self
.
assertRaises
(
ValueError
,
base
.
replace
,
second
=
100
)
self
.
assertRaises
(
ValueError
,
base
.
replace
,
microsecond
=
1000000
)
self
.
assertRaises
(
ValueError
,
base
.
replace
,
microsecond
=
1000000
)
def
test_subclass_replace
(
self
):
class
TimeSubclass
(
self
.
theclass
):
pass
ctime
=
TimeSubclass
(
12
,
30
)
self
.
assertIs
(
type
(
ctime
.
replace
(
hour
=
10
)),
TimeSubclass
)
def
test_subclass_time
(
self
):
def
test_subclass_time
(
self
):
class
C
(
self
.
theclass
):
class
C
(
self
.
theclass
):
...
...
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