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
b0a2a2b0
Kaydet (Commit)
b0a2a2b0
authored
Ara 28, 2017
tarafından
shanghui
Kaydeden (comit)
Tim Graham
Ara 29, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Made a few cleanups to invalid_models_tests.test_models.
üst
51ae4e1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
32 deletions
+18
-32
test_models.py
tests/invalid_models_tests/test_models.py
+18
-32
No files found.
tests/invalid_models_tests/test_models.py
Dosyayı görüntüle @
b0a2a2b0
...
...
@@ -75,9 +75,7 @@ class IndexTogetherTests(SimpleTestCase):
def
test_pointing_to_missing_field
(
self
):
class
Model
(
models
.
Model
):
class
Meta
:
index_together
=
[
[
"missing_field"
],
]
index_together
=
[[
'missing_field'
]]
self
.
assertEqual
(
Model
.
check
(),
[
Error
(
...
...
@@ -95,15 +93,13 @@ class IndexTogetherTests(SimpleTestCase):
field2
=
models
.
IntegerField
()
class
Meta
:
index_together
=
[
[
"field2"
,
"field1"
],
]
index_together
=
[[
'field2'
,
'field1'
]]
self
.
assertEqual
(
Bar
.
check
(),
[
Error
(
"'index_together' refers to field 'field1' which is not "
"local to model 'Bar'."
,
hint
=
(
"This issue may be caused by multi-table inheritance."
)
,
hint
=
'This issue may be caused by multi-table inheritance.'
,
obj
=
Bar
,
id
=
'models.E016'
,
),
...
...
@@ -114,9 +110,7 @@ class IndexTogetherTests(SimpleTestCase):
m2m
=
models
.
ManyToManyField
(
'self'
)
class
Meta
:
index_together
=
[
[
"m2m"
],
]
index_together
=
[[
'm2m'
]]
self
.
assertEqual
(
Model
.
check
(),
[
Error
(
...
...
@@ -188,9 +182,7 @@ class UniqueTogetherTests(SimpleTestCase):
def
test_pointing_to_missing_field
(
self
):
class
Model
(
models
.
Model
):
class
Meta
:
unique_together
=
[
[
"missing_field"
],
]
unique_together
=
[[
'missing_field'
]]
self
.
assertEqual
(
Model
.
check
(),
[
Error
(
...
...
@@ -205,9 +197,7 @@ class UniqueTogetherTests(SimpleTestCase):
m2m
=
models
.
ManyToManyField
(
'self'
)
class
Meta
:
unique_together
=
[
[
"m2m"
],
]
unique_together
=
[[
'm2m'
]]
self
.
assertEqual
(
Model
.
check
(),
[
Error
(
...
...
@@ -311,21 +301,21 @@ class FieldNamesTests(SimpleTestCase):
class
ModelWithLongField
(
models
.
Model
):
m2m_field
=
models
.
ManyToManyField
(
VeryLongModelNamezzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
,
related_name
=
"rn1"
related_name
=
'rn1'
,
)
m2m_field2
=
models
.
ManyToManyField
(
VeryLongModelNamezzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
,
related_name
=
"rn2"
,
through
=
'm2msimple'
related_name
=
'rn2'
,
through
=
'm2msimple'
,
)
m2m_field3
=
models
.
ManyToManyField
(
VeryLongModelNamezzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
,
related_name
=
"rn3"
,
through
=
'm2mcomplex'
related_name
=
'rn3'
,
through
=
'm2mcomplex'
,
)
fk
=
models
.
ForeignKey
(
VeryLongModelNamezzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
,
models
.
CASCADE
,
related_name
=
"rn4"
,
related_name
=
'rn4'
,
)
# Models used for setting `through` in M2M field.
...
...
@@ -567,7 +557,7 @@ class OtherModelTests(SimpleTestCase):
def
test_ordering_non_iterable
(
self
):
class
Model
(
models
.
Model
):
class
Meta
:
ordering
=
"missing_field"
ordering
=
'missing_field'
self
.
assertEqual
(
Model
.
check
(),
[
Error
(
...
...
@@ -640,7 +630,7 @@ class OtherModelTests(SimpleTestCase):
def
test_ordering_pointing_to_missing_field
(
self
):
class
Model
(
models
.
Model
):
class
Meta
:
ordering
=
(
"missing_field"
,)
ordering
=
(
'missing_field'
,)
self
.
assertEqual
(
Model
.
check
(),
[
Error
(
...
...
@@ -651,13 +641,11 @@ class OtherModelTests(SimpleTestCase):
])
def
test_ordering_pointing_to_missing_foreignkey_field
(
self
):
# refs #22711
class
Model
(
models
.
Model
):
missing_fk_field
=
models
.
IntegerField
()
class
Meta
:
ordering
=
(
"missing_fk_field_id"
,)
ordering
=
(
'missing_fk_field_id'
,)
self
.
assertEqual
(
Model
.
check
(),
[
Error
(
...
...
@@ -667,9 +655,7 @@ class OtherModelTests(SimpleTestCase):
)
])
def
test_ordering_pointing_to_existing_foreignkey_field
(
self
):
# refs #22711
def
test_ordering_pointing_to_foreignkey_field
(
self
):
class
Parent
(
models
.
Model
):
pass
...
...
@@ -677,7 +663,7 @@ class OtherModelTests(SimpleTestCase):
parent
=
models
.
ForeignKey
(
Parent
,
models
.
CASCADE
)
class
Meta
:
ordering
=
(
"parent_id"
,)
ordering
=
(
'parent_id'
,)
self
.
assertFalse
(
Child
.
check
())
...
...
@@ -752,8 +738,8 @@ class OtherModelTests(SimpleTestCase):
pass
class
Group
(
models
.
Model
):
primary
=
models
.
ManyToManyField
(
Person
,
through
=
"Membership"
,
related_name
=
"primary"
)
secondary
=
models
.
ManyToManyField
(
Person
,
through
=
"Membership"
,
related_name
=
"secondary"
)
primary
=
models
.
ManyToManyField
(
Person
,
through
=
'Membership'
,
related_name
=
'primary'
)
secondary
=
models
.
ManyToManyField
(
Person
,
through
=
'Membership'
,
related_name
=
'secondary'
)
class
Membership
(
models
.
Model
):
person
=
models
.
ForeignKey
(
Person
,
models
.
CASCADE
)
...
...
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