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
671757b5
Kaydet (Commit)
671757b5
authored
Eki 04, 2013
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #21161 -- Timezone-related tests on Windows.
Thanks Xelnor for the patch.
üst
ecaba360
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
7 deletions
+18
-7
AUTHORS
AUTHORS
+1
-0
filters.py
tests/template_tests/filters.py
+10
-7
test_timesince.py
tests/utils_tests/test_timesince.py
+7
-0
No files found.
AUTHORS
Dosyayı görüntüle @
671757b5
...
...
@@ -96,6 +96,7 @@ answer newbie questions, and generally made Django that much better:
Mikaël Barbero <mikael.barbero nospam at nospam free.fr>
Randy Barlow <randy@electronsweatshop.com>
Scott Barr <scott@divisionbyzero.com.au>
Raphaël Barrois <raphael.barrois@m4x.org>
Jiri Barton
Jorge Bastida <me@jorgebastida.com>
Ned Batchelder <http://www.nedbatchelder.com/>
...
...
tests/template_tests/filters.py
Dosyayı görüntüle @
671757b5
...
...
@@ -10,7 +10,7 @@ from __future__ import unicode_literals
from
datetime
import
date
,
datetime
,
time
,
timedelta
from
django.test.utils
import
str_prefix
from
django.test.utils
import
str_prefix
,
TZ_SUPPORT
from
django.utils.encoding
import
python_2_unicode_compatible
from
django.utils.safestring
import
mark_safe
from
django.utils
import
timezone
...
...
@@ -56,9 +56,10 @@ def get_filter_tests():
'filter-timesince10'
:
(
'{{ later|timesince:now }}'
,
{
'now'
:
now
,
'later'
:
now
+
timedelta
(
days
=
7
)
},
'0
\xa0
minutes'
),
# Ensures that differing timezones are calculated correctly
# Tests trying to compare a timezone-aware 'now' to now aren't supported on no-tz-support systems (e.g Windows).
'filter-timesince11'
:
(
'{{ a|timesince }}'
,
{
'a'
:
now
},
'0
\xa0
minutes'
),
'filter-timesince12'
:
(
'{{ a|timesince }}'
,
{
'a'
:
now_tz
},
'0
\xa0
minutes'
),
'filter-timesince13'
:
(
'{{ a|timesince }}'
,
{
'a'
:
now_tz_i
},
'0
\xa0
minutes'
),
'filter-timesince12'
:
(
'{{ a|timesince }}'
,
{
'a'
:
now_tz
},
'0
\xa0
minutes'
)
if
TZ_SUPPORT
else
(
''
,
{},
''
)
,
'filter-timesince13'
:
(
'{{ a|timesince }}'
,
{
'a'
:
now_tz_i
},
'0
\xa0
minutes'
)
if
TZ_SUPPORT
else
(
''
,
{},
''
)
,
'filter-timesince14'
:
(
'{{ a|timesince:b }}'
,
{
'a'
:
now_tz
,
'b'
:
now_tz_i
},
'0
\xa0
minutes'
),
'filter-timesince15'
:
(
'{{ a|timesince:b }}'
,
{
'a'
:
now
,
'b'
:
now_tz_i
},
''
),
'filter-timesince16'
:
(
'{{ a|timesince:b }}'
,
{
'a'
:
now_tz_i
,
'b'
:
now
},
''
),
...
...
@@ -83,12 +84,14 @@ def get_filter_tests():
'filter-timeuntil09'
:
(
'{{ later|timeuntil:now }}'
,
{
'now'
:
now
,
'later'
:
now
+
timedelta
(
days
=
7
)
},
'1
\xa0
week'
),
# Ensures that differing timezones are calculated correctly
'filter-timeuntil10'
:
(
'{{ a|timeuntil }}'
,
{
'a'
:
now_tz_i
},
'0
\xa0
minutes'
),
'filter-timeuntil11'
:
(
'{{ a|timeuntil:b }}'
,
{
'a'
:
now_tz_i
,
'b'
:
now_tz
},
'0
\xa0
minutes'
),
# Tests trying to compare a timezone-aware 'now' to now aren't supported on no-tz-support systems (e.g Windows).
'filter-timeuntil10'
:
(
'{{ a|timeuntil }}'
,
{
'a'
:
now_tz
},
'0
\xa0
minutes'
)
if
TZ_SUPPORT
else
(
''
,
{},
''
),
'filter-timeuntil11'
:
(
'{{ a|timeuntil }}'
,
{
'a'
:
now_tz_i
},
'0
\xa0
minutes'
)
if
TZ_SUPPORT
else
(
''
,
{},
''
),
'filter-timeuntil12'
:
(
'{{ a|timeuntil:b }}'
,
{
'a'
:
now_tz_i
,
'b'
:
now_tz
},
'0
\xa0
minutes'
),
# Regression for #9065 (two date objects).
'filter-timeuntil1
2
'
:
(
'{{ a|timeuntil:b }}'
,
{
'a'
:
today
,
'b'
:
today
},
'0
\xa0
minutes'
),
'filter-timeuntil1
3
'
:
(
'{{ a|timeuntil:b }}'
,
{
'a'
:
today
,
'b'
:
today
-
timedelta
(
hours
=
24
)},
'1
\xa0
day'
),
'filter-timeuntil1
3
'
:
(
'{{ a|timeuntil:b }}'
,
{
'a'
:
today
,
'b'
:
today
},
'0
\xa0
minutes'
),
'filter-timeuntil1
4
'
:
(
'{{ a|timeuntil:b }}'
,
{
'a'
:
today
,
'b'
:
today
-
timedelta
(
hours
=
24
)},
'1
\xa0
day'
),
'filter-addslash01'
:
(
"{
%
autoescape off
%
}{{ a|addslashes }} {{ b|addslashes }}{
%
endautoescape
%
}"
,
{
"a"
:
"<a>'"
,
"b"
:
mark_safe
(
"<a>'"
)},
r"<a>\' <a>\'"
),
'filter-addslash02'
:
(
"{{ a|addslashes }} {{ b|addslashes }}"
,
{
"a"
:
"<a>'"
,
"b"
:
mark_safe
(
"<a>'"
)},
r"<a>\' <a>\'"
),
...
...
tests/utils_tests/test_timesince.py
Dosyayı görüntüle @
671757b5
...
...
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
import
datetime
import
unittest
from
django.test.utils
import
requires_tz_support
from
django.utils.timesince
import
timesince
,
timeuntil
from
django.utils
import
timezone
...
...
@@ -93,6 +94,7 @@ class TimesinceTests(unittest.TestCase):
self
.
assertEqual
(
timesince
(
self
.
t
,
self
.
t
-
4
*
self
.
oneday
-
5
*
self
.
oneminute
),
'0
\xa0
minutes'
)
@requires_tz_support
def
test_different_timezones
(
self
):
""" When using two different timezones. """
now
=
datetime
.
datetime
.
now
()
...
...
@@ -101,6 +103,11 @@ class TimesinceTests(unittest.TestCase):
self
.
assertEqual
(
timesince
(
now
),
'0
\xa0
minutes'
)
self
.
assertEqual
(
timesince
(
now_tz
),
'0
\xa0
minutes'
)
self
.
assertEqual
(
timesince
(
now_tz_i
),
'0
\xa0
minutes'
)
self
.
assertEqual
(
timesince
(
now_tz
,
now_tz_i
),
'0
\xa0
minutes'
)
self
.
assertEqual
(
timeuntil
(
now
),
'0
\xa0
minutes'
)
self
.
assertEqual
(
timeuntil
(
now_tz
),
'0
\xa0
minutes'
)
self
.
assertEqual
(
timeuntil
(
now_tz_i
),
'0
\xa0
minutes'
)
self
.
assertEqual
(
timeuntil
(
now_tz
,
now_tz_i
),
'0
\xa0
minutes'
)
def
test_date_objects
(
self
):
...
...
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