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
0027ca76
Kaydet (Commit)
0027ca76
authored
Mar 31, 2019
tarafından
JangHyukJin
Kaydeden (comit)
Mariusz Felisiak
Nis 01, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Used QuerySet.bulk_create() in lookup.tests.
üst
8335d592
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
27 deletions
+35
-27
AUTHORS
AUTHORS
+1
-0
tests.py
tests/lookup/tests.py
+34
-27
No files found.
AUTHORS
Dosyayı görüntüle @
0027ca76
...
...
@@ -341,6 +341,7 @@ answer newbie questions, and generally made Django that much better:
Honza Král <honza.kral@gmail.com>
Horst Gutmann <zerok@zerokspot.com>
Hugo Osvaldo Barrera <hugo@barrera.io>
HyukJin Jang <wkdgurwls00@naver.com>
Hyun Mi Ae
Iacopo Spalletti <i.spalletti@nephila.it>
Ian A Wilson <http://ianawilson.com>
...
...
tests/lookup/tests.py
Dosyayı görüntüle @
0027ca76
...
...
@@ -478,10 +478,11 @@ class LookupTests(TestCase):
)
def
test_exclude
(
self
):
Article
.
objects
.
create
(
headline
=
'Article_ with underscore'
,
pub_date
=
datetime
(
2005
,
11
,
20
))
Article
.
objects
.
create
(
headline
=
'Article
%
with percent sign'
,
pub_date
=
datetime
(
2005
,
11
,
21
))
Article
.
objects
.
create
(
headline
=
'Article with
\\
backslash'
,
pub_date
=
datetime
(
2005
,
11
,
22
))
Article
.
objects
.
bulk_create
([
Article
(
headline
=
'Article_ with underscore'
,
pub_date
=
datetime
(
2005
,
11
,
20
)),
Article
(
headline
=
'Article
%
with percent sign'
,
pub_date
=
datetime
(
2005
,
11
,
21
)),
Article
(
headline
=
'Article with
\\
backslash'
,
pub_date
=
datetime
(
2005
,
11
,
22
)),
])
# exclude() is the opposite of filter() when doing lookups:
self
.
assertQuerysetEqual
(
Article
.
objects
.
filter
(
headline__contains
=
'Article'
)
.
exclude
(
headline__contains
=
'with'
),
...
...
@@ -606,15 +607,17 @@ class LookupTests(TestCase):
for
a
in
Article
.
objects
.
all
():
a
.
delete
()
now
=
datetime
.
now
()
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'f'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'fo'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'foo'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'fooo'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'hey-Foo'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'bar'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'AbBa'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'baz'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'baxZ'
)
Article
.
objects
.
bulk_create
([
Article
(
pub_date
=
now
,
headline
=
'f'
),
Article
(
pub_date
=
now
,
headline
=
'fo'
),
Article
(
pub_date
=
now
,
headline
=
'foo'
),
Article
(
pub_date
=
now
,
headline
=
'fooo'
),
Article
(
pub_date
=
now
,
headline
=
'hey-Foo'
),
Article
(
pub_date
=
now
,
headline
=
'bar'
),
Article
(
pub_date
=
now
,
headline
=
'AbBa'
),
Article
(
pub_date
=
now
,
headline
=
'baz'
),
Article
(
pub_date
=
now
,
headline
=
'baxZ'
),
])
# zero-or-more
self
.
assertQuerysetEqual
(
Article
.
objects
.
filter
(
headline__regex
=
r'fo*'
),
...
...
@@ -664,13 +667,15 @@ class LookupTests(TestCase):
)
# and more articles:
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'foobar'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'foobaz'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'ooF'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'foobarbaz'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'zoocarfaz'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'barfoobaz'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'bazbaRFOO'
)
Article
.
objects
.
bulk_create
([
Article
(
pub_date
=
now
,
headline
=
'foobar'
),
Article
(
pub_date
=
now
,
headline
=
'foobaz'
),
Article
(
pub_date
=
now
,
headline
=
'ooF'
),
Article
(
pub_date
=
now
,
headline
=
'foobarbaz'
),
Article
(
pub_date
=
now
,
headline
=
'zoocarfaz'
),
Article
(
pub_date
=
now
,
headline
=
'barfoobaz'
),
Article
(
pub_date
=
now
,
headline
=
'bazbaRFOO'
),
])
# alternation
self
.
assertQuerysetEqual
(
...
...
@@ -723,13 +728,15 @@ class LookupTests(TestCase):
def
test_regex_backreferencing
(
self
):
# grouping and backreferences
now
=
datetime
.
now
()
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'foobar'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'foobaz'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'ooF'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'foobarbaz'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'zoocarfaz'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'barfoobaz'
)
Article
.
objects
.
create
(
pub_date
=
now
,
headline
=
'bazbaRFOO'
)
Article
.
objects
.
bulk_create
([
Article
(
pub_date
=
now
,
headline
=
'foobar'
),
Article
(
pub_date
=
now
,
headline
=
'foobaz'
),
Article
(
pub_date
=
now
,
headline
=
'ooF'
),
Article
(
pub_date
=
now
,
headline
=
'foobarbaz'
),
Article
(
pub_date
=
now
,
headline
=
'zoocarfaz'
),
Article
(
pub_date
=
now
,
headline
=
'barfoobaz'
),
Article
(
pub_date
=
now
,
headline
=
'bazbaRFOO'
),
])
self
.
assertQuerysetEqual
(
Article
.
objects
.
filter
(
headline__regex
=
r'b(.).*b\1'
),
[
'<Article: barfoobaz>'
,
'<Article: bazbaRFOO>'
,
'<Article: foobarbaz>'
]
...
...
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