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
e7366ab1
Kaydet (Commit)
e7366ab1
authored
Nis 01, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[1.8.x] Fixed mistakes in tests unveiled by version bump to 1.8.1.
üst
b0512db5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
13 deletions
+14
-13
test_pickle.py
tests/model_regress/test_pickle.py
+7
-6
models.py
tests/queryset_pickle/models.py
+1
-2
tests.py
tests/queryset_pickle/tests.py
+6
-5
No files found.
tests/model_regress/test_pickle.py
Dosyayı görüntüle @
e7366ab1
...
...
@@ -9,7 +9,7 @@ from django.core.files.temp import NamedTemporaryFile
from
django.db
import
DJANGO_VERSION_PICKLE_KEY
,
models
from
django.test
import
TestCase
from
django.utils.encoding
import
force_text
from
django.utils.version
import
get_
major_version
,
get_
version
from
django.utils.version
import
get_version
from
.models
import
Article
...
...
@@ -47,17 +47,18 @@ class ModelPickleTestCase(TestCase):
def
__reduce__
(
self
):
reduce_list
=
super
(
DifferentDjangoVersion
,
self
)
.
__reduce__
()
data
=
reduce_list
[
-
1
]
data
[
DJANGO_VERSION_PICKLE_KEY
]
=
str
(
float
(
get_major_version
())
-
0.1
)
data
[
DJANGO_VERSION_PICKLE_KEY
]
=
'1.0'
return
reduce_list
p
=
DifferentDjangoVersion
(
title
=
"FooBar"
)
with
warnings
.
catch_warnings
(
record
=
True
)
as
recorded
:
pickle
.
loads
(
pickle
.
dumps
(
p
))
msg
=
force_text
(
recorded
.
pop
()
.
message
)
self
.
assertEqual
(
msg
,
"Pickled model instance's Django version
%
s does not "
"match the current version
%
s."
%
(
str
(
float
(
get_major_version
())
-
0.1
),
get_version
()))
self
.
assertEqual
(
msg
,
"Pickled model instance's Django version 1.0 does not "
"match the current version
%
s."
%
get_version
()
)
def
test_unpickling_when_appregistrynotready
(
self
):
"""
...
...
tests/queryset_pickle/models.py
Dosyayı görüntüle @
e7366ab1
...
...
@@ -2,7 +2,6 @@ import datetime
from
django.db
import
DJANGO_VERSION_PICKLE_KEY
,
models
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.version
import
get_major_version
def
standalone_number
():
...
...
@@ -27,7 +26,7 @@ nn = Numbers()
class
PreviousDjangoVersionQuerySet
(
models
.
QuerySet
):
def
__getstate__
(
self
):
state
=
super
(
PreviousDjangoVersionQuerySet
,
self
)
.
__getstate__
()
state
[
DJANGO_VERSION_PICKLE_KEY
]
=
str
(
float
(
get_major_version
())
-
0.1
)
# previous major version
state
[
DJANGO_VERSION_PICKLE_KEY
]
=
'1.0'
return
state
...
...
tests/queryset_pickle/tests.py
Dosyayı görüntüle @
e7366ab1
...
...
@@ -6,7 +6,7 @@ import warnings
from
django.test
import
TestCase
from
django.utils.encoding
import
force_text
from
django.utils.version
import
get_
major_version
,
get_
version
from
django.utils.version
import
get_version
from
.models
import
Container
,
Event
,
Group
,
Happening
,
M2MModel
...
...
@@ -141,7 +141,8 @@ class PickleabilityTestCase(TestCase):
with
warnings
.
catch_warnings
(
record
=
True
)
as
recorded
:
pickle
.
loads
(
pickle
.
dumps
(
qs
))
msg
=
force_text
(
recorded
.
pop
()
.
message
)
self
.
assertEqual
(
msg
,
"Pickled queryset instance's Django version
%
s does not "
"match the current version
%
s."
%
(
str
(
float
(
get_major_version
())
-
0.1
),
get_version
()))
self
.
assertEqual
(
msg
,
"Pickled queryset instance's Django version 1.0 does not "
"match the current version
%
s."
%
get_version
()
)
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