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
3ca24fd1
Kaydet (Commit)
3ca24fd1
authored
Agu 16, 2018
tarafından
oliver
Kaydeden (comit)
Tim Graham
Agu 16, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Optimized some cache tests with set_many().
üst
7f6b013b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
17 deletions
+6
-17
tests.py
tests/cache/tests.py
+6
-17
No files found.
tests/cache/tests.py
Dosyayı görüntüle @
3ca24fd1
...
...
@@ -92,10 +92,7 @@ class DummyCacheTests(SimpleTestCase):
def
test_get_many
(
self
):
"get_many returns nothing for the dummy cache backend"
cache
.
set
(
'a'
,
'a'
)
cache
.
set
(
'b'
,
'b'
)
cache
.
set
(
'c'
,
'c'
)
cache
.
set
(
'd'
,
'd'
)
cache
.
set_many
({
'a'
:
'a'
,
'b'
:
'b'
,
'c'
:
'c'
,
'd'
:
'd'
})
self
.
assertEqual
(
cache
.
get_many
([
'a'
,
'c'
,
'd'
]),
{})
self
.
assertEqual
(
cache
.
get_many
([
'a'
,
'b'
,
'e'
]),
{})
...
...
@@ -105,8 +102,7 @@ class DummyCacheTests(SimpleTestCase):
def
test_delete
(
self
):
"Cache deletion is transparently ignored on the dummy cache backend"
cache
.
set
(
"key1"
,
"spam"
)
cache
.
set
(
"key2"
,
"eggs"
)
cache
.
set_many
({
'key1'
:
'spam'
,
'key2'
:
'eggs'
})
self
.
assertIsNone
(
cache
.
get
(
"key1"
))
cache
.
delete
(
"key1"
)
self
.
assertIsNone
(
cache
.
get
(
"key1"
))
...
...
@@ -306,18 +302,14 @@ class BaseCacheTests:
def
test_get_many
(
self
):
# Multiple cache keys can be returned using get_many
cache
.
set
(
'a'
,
'a'
)
cache
.
set
(
'b'
,
'b'
)
cache
.
set
(
'c'
,
'c'
)
cache
.
set
(
'd'
,
'd'
)
cache
.
set_many
({
'a'
:
'a'
,
'b'
:
'b'
,
'c'
:
'c'
,
'd'
:
'd'
})
self
.
assertEqual
(
cache
.
get_many
([
'a'
,
'c'
,
'd'
]),
{
'a'
:
'a'
,
'c'
:
'c'
,
'd'
:
'd'
})
self
.
assertEqual
(
cache
.
get_many
([
'a'
,
'b'
,
'e'
]),
{
'a'
:
'a'
,
'b'
:
'b'
})
self
.
assertEqual
(
cache
.
get_many
(
iter
([
'a'
,
'b'
,
'e'
])),
{
'a'
:
'a'
,
'b'
:
'b'
})
def
test_delete
(
self
):
# Cache keys can be deleted
cache
.
set
(
"key1"
,
"spam"
)
cache
.
set
(
"key2"
,
"eggs"
)
cache
.
set_many
({
'key1'
:
'spam'
,
'key2'
:
'eggs'
})
self
.
assertEqual
(
cache
.
get
(
"key1"
),
"spam"
)
cache
.
delete
(
"key1"
)
self
.
assertIsNone
(
cache
.
get
(
"key1"
))
...
...
@@ -521,9 +513,7 @@ class BaseCacheTests:
def
test_delete_many
(
self
):
# Multiple keys can be deleted using delete_many
cache
.
set
(
"key1"
,
"spam"
)
cache
.
set
(
"key2"
,
"eggs"
)
cache
.
set
(
"key3"
,
"ham"
)
cache
.
set_many
({
'key1'
:
'spam'
,
'key2'
:
'eggs'
,
'key3'
:
'ham'
})
cache
.
delete_many
([
"key1"
,
"key2"
])
self
.
assertIsNone
(
cache
.
get
(
"key1"
))
self
.
assertIsNone
(
cache
.
get
(
"key2"
))
...
...
@@ -531,8 +521,7 @@ class BaseCacheTests:
def
test_clear
(
self
):
# The cache can be emptied using clear
cache
.
set
(
"key1"
,
"spam"
)
cache
.
set
(
"key2"
,
"eggs"
)
cache
.
set_many
({
'key1'
:
'spam'
,
'key2'
:
'eggs'
})
cache
.
clear
()
self
.
assertIsNone
(
cache
.
get
(
"key1"
))
self
.
assertIsNone
(
cache
.
get
(
"key2"
))
...
...
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