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
9d129b72
Kaydet (Commit)
9d129b72
authored
Ock 23, 2018
tarafından
Daniel Hones
Kaydeden (comit)
Tim Graham
Ock 24, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29047 -- Corrected Substr test to use expressions.
Regression in
e2d6e146
.
üst
28708799
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
tests.py
tests/db_functions/tests.py
+6
-5
No files found.
tests/db_functions/tests.py
Dosyayı görüntüle @
9d129b72
...
@@ -6,8 +6,8 @@ from django.db import connection
...
@@ -6,8 +6,8 @@ from django.db import connection
from
django.db.models
import
CharField
,
TextField
,
Value
as
V
from
django.db.models
import
CharField
,
TextField
,
Value
as
V
from
django.db.models.expressions
import
RawSQL
from
django.db.models.expressions
import
RawSQL
from
django.db.models.functions
import
(
from
django.db.models.functions
import
(
Coalesce
,
Concat
,
ConcatPair
,
Greatest
,
Least
,
Length
,
Lower
,
Now
,
Substr
,
Coalesce
,
Concat
,
ConcatPair
,
Greatest
,
Least
,
Length
,
Lower
,
Now
,
Upper
,
StrIndex
,
Substr
,
Upper
,
)
)
from
django.test
import
TestCase
,
skipIfDBFeature
,
skipUnlessDBFeature
from
django.test
import
TestCase
,
skipIfDBFeature
,
skipUnlessDBFeature
from
django.utils
import
timezone
from
django.utils
import
timezone
...
@@ -510,11 +510,12 @@ class FunctionTests(TestCase):
...
@@ -510,11 +510,12 @@ class FunctionTests(TestCase):
def
test_substr_with_expressions
(
self
):
def
test_substr_with_expressions
(
self
):
Author
.
objects
.
create
(
name
=
'John Smith'
,
alias
=
'smithj'
)
Author
.
objects
.
create
(
name
=
'John Smith'
,
alias
=
'smithj'
)
Author
.
objects
.
create
(
name
=
'Rhonda'
)
Author
.
objects
.
create
(
name
=
'Rhonda'
)
authors
=
Author
.
objects
.
annotate
(
name_part
=
Substr
(
'name'
,
5
,
3
))
substr
=
Substr
(
Upper
(
'name'
),
StrIndex
(
'name'
,
V
(
'h'
)),
5
,
output_field
=
CharField
())
authors
=
Author
.
objects
.
annotate
(
name_part
=
substr
)
self
.
assertQuerysetEqual
(
self
.
assertQuerysetEqual
(
authors
.
order_by
(
'name'
),
[
authors
.
order_by
(
'name'
),
[
'
Sm
'
,
'
HN SM
'
,
'
da
'
,
'
HONDA
'
,
],
],
lambda
a
:
a
.
name_part
lambda
a
:
a
.
name_part
)
)
...
...
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