Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
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
django
Commits
99fc5dc1
Kaydet (Commit)
99fc5dc1
authored
Şub 16, 2019
tarafından
Seunghun Lee
Kaydeden (comit)
Tim Graham
Şub 23, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #30141 -- Fixed parse_duration() for some negative durations.
üst
36300ef3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
dateparse.py
django/utils/dateparse.py
+4
-3
test_dateparse.py
tests/utils_tests/test_dateparse.py
+5
-2
No files found.
django/utils/dateparse.py
Dosyayı görüntüle @
99fc5dc1
...
@@ -29,9 +29,10 @@ datetime_re = re.compile(
...
@@ -29,9 +29,10 @@ datetime_re = re.compile(
standard_duration_re
=
re
.
compile
(
standard_duration_re
=
re
.
compile
(
r'^'
r'^'
r'(?:(?P<days>-?\d+) (days?, )?)?'
r'(?:(?P<days>-?\d+) (days?, )?)?'
r'((?:(?P<hours>-?\d+):)(?=\d+:\d+))?'
r'(?P<sign>-?)'
r'(?:(?P<minutes>-?\d+):)?'
r'((?:(?P<hours>\d+):)(?=\d+:\d+))?'
r'(?P<seconds>-?\d+)'
r'(?:(?P<minutes>\d+):)?'
r'(?P<seconds>\d+)'
r'(?:\.(?P<microseconds>\d{1,6})\d{0,6})?'
r'(?:\.(?P<microseconds>\d{1,6})\d{0,6})?'
r'$'
r'$'
)
)
...
...
tests/utils_tests/test_dateparse.py
Dosyayı görüntüle @
99fc5dc1
...
@@ -113,9 +113,12 @@ class DurationParseTests(unittest.TestCase):
...
@@ -113,9 +113,12 @@ class DurationParseTests(unittest.TestCase):
test_values
=
(
test_values
=
(
(
'-4 15:30'
,
timedelta
(
days
=-
4
,
minutes
=
15
,
seconds
=
30
)),
(
'-4 15:30'
,
timedelta
(
days
=-
4
,
minutes
=
15
,
seconds
=
30
)),
(
'-172800'
,
timedelta
(
days
=-
2
)),
(
'-172800'
,
timedelta
(
days
=-
2
)),
(
'-15:30'
,
timedelta
(
minutes
=-
15
,
seconds
=
30
)),
(
'-15:30'
,
timedelta
(
minutes
=-
15
,
seconds
=
-
30
)),
(
'-1:15:30'
,
timedelta
(
hours
=-
1
,
minutes
=
15
,
seconds
=
30
)),
(
'-1:15:30'
,
timedelta
(
hours
=-
1
,
minutes
=
-
15
,
seconds
=-
30
)),
(
'-30.1'
,
timedelta
(
seconds
=-
30
,
milliseconds
=-
100
)),
(
'-30.1'
,
timedelta
(
seconds
=-
30
,
milliseconds
=-
100
)),
(
'-00:01:01'
,
timedelta
(
minutes
=-
1
,
seconds
=-
1
)),
(
'-01:01'
,
timedelta
(
seconds
=-
61
)),
(
'-01:-01'
,
None
),
)
)
for
source
,
expected
in
test_values
:
for
source
,
expected
in
test_values
:
with
self
.
subTest
(
source
=
source
):
with
self
.
subTest
(
source
=
source
):
...
...
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